@insignia-education/api-sdk-js 0.9.17 → 0.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insignia-education/api-sdk-js",
3
- "version": "0.9.17",
3
+ "version": "0.9.18",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/Client.js CHANGED
@@ -6,10 +6,12 @@ export default class InsigniaClient {
6
6
  }
7
7
 
8
8
  static _resolve(baseUrl) {
9
- baseUrl = baseUrl
10
- ?? process.env.INSIGNIA_EDUCATION_API_BASE_URL
11
- ?? 'https://insigniaeducation.com';
12
- baseUrl = baseUrl.replace(/\/$/, '')
9
+ const envBaseUrl = typeof process !== 'undefined'
10
+ ? process.env?.INSIGNIA_EDUCATION_API_BASE_URL ?? null
11
+ : null;
12
+
13
+ baseUrl = baseUrl ?? envBaseUrl ?? 'https://insigniaeducation.com';
14
+ baseUrl = baseUrl.replace(/\/$/, '');
13
15
  return baseUrl;
14
16
  }
15
17
 
@@ -74,3 +74,19 @@ describe('Languages', () => {
74
74
  });
75
75
  });
76
76
 
77
+
78
+
79
+ describe('Auth', () => {
80
+ test('get() returns a list', async () => {
81
+ const res = await api.auth.login({
82
+ email: process.env.TEST_EMAIL,
83
+ password: process.env.TEST_PASSWORD
84
+ })
85
+ .then(response => {
86
+
87
+ expect(response["success"]).toBeDefined();
88
+ expect(response["success"]).toBe("ok");
89
+ });
90
+ });
91
+ });
92
+