@insignia-education/api-sdk-js 0.15.61 → 0.15.63
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/.github/workflows/npm-publish-github-packages.yml +95 -12
- package/coverage/clover.xml +132 -1512
- package/coverage/coverage-final.json +1 -47
- package/coverage/lcov-report/Client.js.html +463 -0
- package/coverage/lcov-report/index.html +20 -65
- package/coverage/lcov-report/src/Client.js.html +141 -132
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Accounts.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Admin.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Auth.js.html +7 -7
- package/coverage/lcov-report/src/api/v1/Categories.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Changelogs.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Configs.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/ContactForms.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/ConversationalTopics.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Countries.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Coupons.js.html +16 -16
- package/coverage/lcov-report/src/api/v1/Courses.js.html +27 -27
- package/coverage/lcov-report/src/api/v1/Currencies.js.html +10 -10
- package/coverage/lcov-report/src/api/v1/Dashboard.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/EducationCenter.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Employee.js.html +5 -5
- package/coverage/lcov-report/src/api/v1/Files.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Forums.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Hashes.js.html +16 -13
- package/coverage/lcov-report/src/api/v1/Insignias.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Languages.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/MailBlacklist.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/MailingLists.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Offers.js.html +16 -16
- package/coverage/lcov-report/src/api/v1/Organizations.js.html +52 -52
- package/coverage/lcov-report/src/api/v1/PaymentMethods.js.html +7 -7
- package/coverage/lcov-report/src/api/v1/Payments.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Premiums.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Quizzes.js.html +42 -42
- package/coverage/lcov-report/src/api/v1/Sales.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Search.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/ShortLinks.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Surveys.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Taxes.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Teacher.js.html +100 -70
- package/coverage/lcov-report/src/api/v1/Telegram.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/TwoFactor.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/UserSessionTypes.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/UserTypes.js.html +8 -8
- package/coverage/lcov-report/src/api/v1/Users.js.html +112 -16
- package/coverage/lcov-report/src/api/v1/Utm.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Webauthn.js.html +3 -3
- package/coverage/lcov-report/src/api/v1/Zoom.js.html +19 -19
- package/coverage/lcov-report/src/api/v1/index.html +154 -184
- package/coverage/lcov-report/src/api/v1/index.js.html +52 -64
- package/coverage/lcov-report/src/index.html +21 -21
- package/coverage/lcov-report/src/index.js.html +3 -3
- package/coverage/lcov-report/tests/helpers.js.html +11 -11
- package/coverage/lcov-report/tests/index.html +7 -7
- package/coverage/lcov.info +146 -2451
- package/coverage/test-report.html +1 -10
- package/jest.config.mjs +12 -1
- package/package.json +2 -2
- package/src/api/v1/Coupons.js +11 -0
- package/src/api/v1/Courses.js +2 -0
- package/src/api/v1/Hashes.js +3 -2
- package/src/api/v1/Telegram.js +6 -0
- package/src/api/v1/Users.js +12 -0
- package/src/api/v1/index.js +0 -4
- package/tests/integration/api/v1/accounts.test.js +5 -11
- package/tests/integration/api/v1/auth/login.test.js +18 -34
- package/tests/integration/api/v1/conversational-topics.test.js +3 -5
- package/tests/integration/api/v1/countries.test.js +1 -1
- package/tests/integration/api/v1/coupons.test.js +2 -9
- package/tests/integration/api/v1/currencies/index.test.js +1 -1
- package/tests/integration/api/v1/files.test.js +18 -15
- package/tests/integration/api/v1/hashes.test.js +2 -10
- package/tests/integration/api/v1/mail-blacklist.test.js +2 -9
- package/tests/integration/api/v1/offers.test.js +2 -9
- package/tests/integration/api/v1/organizations.test.js +8 -8
- package/tests/integration/api/v1/quizzes/index.test.js +0 -2
- package/tests/integration/api/v1/short-links.test.js +2 -9
- package/tests/integration/api/v1/taxes.test.js +2 -3
- package/tests/integration/api/v1/teacher/index.test.js +1 -1
- package/tests/integration/api/v1/telegram.test.js +33 -0
- package/tests/integration/api/v1/user-types.test.js +2 -4
- package/tests/integration/api/v1/users/index.test.js +10 -13
- package/tests/integration/api/v1/users/telegram.test.js +36 -0
- package/tests/integration/api/v1/zoom.test.js +2 -9
- package/src/api/v1/Categories.js +0 -12
- package/src/api/v1/Configs.js +0 -12
- package/tests/integration/api/v1/categories.test.js +0 -19
- package/tests/integration/api/v1/configs.test.js +0 -20
|
@@ -5,29 +5,26 @@ import {
|
|
|
5
5
|
} from '../../../../helpers.js';
|
|
6
6
|
|
|
7
7
|
describe('api/v1/users', () => {
|
|
8
|
+
// get(id = null) with no id returns the authenticated user's own
|
|
9
|
+
// profile (UserController::get() -> auth()->user()), not a list.
|
|
8
10
|
test('get | authenticated', async () => {
|
|
9
11
|
await loginAdmin();
|
|
10
12
|
await api.users.get()
|
|
11
13
|
.then(response => {
|
|
12
|
-
response
|
|
13
|
-
expect(response
|
|
14
|
-
response.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
expect(user["email"]).toBeDefined();
|
|
18
|
-
expect(user["created_at"]).toBeDefined();
|
|
19
|
-
expect(user["updated_at"]).toBeDefined();
|
|
20
|
-
});
|
|
14
|
+
expect(response["id"]).toBeDefined();
|
|
15
|
+
expect(response["name"]).toBeDefined();
|
|
16
|
+
expect(response["email"]).toBeDefined();
|
|
17
|
+
expect(response["created_at"]).toBeDefined();
|
|
18
|
+
expect(response["updated_at"]).toBeDefined();
|
|
21
19
|
});
|
|
22
20
|
});
|
|
23
21
|
|
|
24
22
|
test('get by id | authenticated', async () => {
|
|
25
23
|
await loginAdmin();
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
await api.users.get(id)
|
|
24
|
+
const me = await api.users.get();
|
|
25
|
+
await api.users.get(me["id"])
|
|
29
26
|
.then(response => {
|
|
30
|
-
expect(response["id"]).toBe(id);
|
|
27
|
+
expect(response["id"]).toBe(me["id"]);
|
|
31
28
|
expect(response["name"]).toBeDefined();
|
|
32
29
|
expect(response["email"]).toBeDefined();
|
|
33
30
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
api,
|
|
3
|
+
loginCustomer,
|
|
4
|
+
} from '../../../../helpers.js';
|
|
5
|
+
|
|
6
|
+
describe('api/v1/users/{id}/telegram', () => {
|
|
7
|
+
test('linkToken | authenticated owner returns a deep link', async () => {
|
|
8
|
+
await loginCustomer();
|
|
9
|
+
const me = await api.users.get();
|
|
10
|
+
await api.users.telegram(me["id"]).linkToken()
|
|
11
|
+
.then(response => {
|
|
12
|
+
expect(response["hash"]).toBeDefined();
|
|
13
|
+
expect(response["link"]).toContain(response["hash"]);
|
|
14
|
+
expect(response["link"]).toMatch(/^https:\/\/t\.me\//);
|
|
15
|
+
expect(response["expires_at"]).toBeDefined();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('connect | rejects an invalid signature', async () => {
|
|
20
|
+
await loginCustomer();
|
|
21
|
+
const me = await api.users.get();
|
|
22
|
+
await expect(api.users.telegram(me["id"]).connect({
|
|
23
|
+
chat_id: '12345',
|
|
24
|
+
username: 'someuser',
|
|
25
|
+
expires_at: Math.floor(Date.now() / 1000) + 600,
|
|
26
|
+
signature: 'not-a-real-signature',
|
|
27
|
+
})).rejects.toMatchObject({ status: 422 });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('connect | missing params returns a validation error', async () => {
|
|
31
|
+
await loginCustomer();
|
|
32
|
+
const me = await api.users.get();
|
|
33
|
+
await expect(api.users.telegram(me["id"]).connect({}))
|
|
34
|
+
.rejects.toMatchObject({ status: 422 });
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const api = new InsigniaApiV1(process.env.INSIGNIA_EDUCATION_API_BASE_URL);
|
|
4
|
-
|
|
5
|
-
const login = () => api.auth.login({
|
|
6
|
-
email: process.env.TEST_EMAIL,
|
|
7
|
-
password: process.env.TEST_PASSWORD,
|
|
8
|
-
});
|
|
1
|
+
import { api, loginAdmin } from '../../../helpers.js';
|
|
9
2
|
|
|
10
3
|
describe('api/v1/zoom/meetings', () => {
|
|
11
4
|
test('get | authenticated', async () => {
|
|
12
|
-
await
|
|
5
|
+
await loginAdmin();
|
|
13
6
|
await api.zoom.meetings().get()
|
|
14
7
|
.then(response => {
|
|
15
8
|
response = Object.values(response);
|
package/src/api/v1/Categories.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default class Categories {
|
|
2
|
-
#client;
|
|
3
|
-
|
|
4
|
-
constructor(client) {
|
|
5
|
-
this.#client = client;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get(id = null) { return id ? this.#client.get(`/categories/${id}`) : this.#client.get('/categories'); }
|
|
9
|
-
create(data) { return this.#client.put('/categories', data); }
|
|
10
|
-
edit(id, data) { return this.#client.patch(`/categories/${id}`, data); }
|
|
11
|
-
delete(id) { return this.#client.del(`/categories/${id}`); }
|
|
12
|
-
}
|
package/src/api/v1/Configs.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export default class Configs {
|
|
2
|
-
#client;
|
|
3
|
-
|
|
4
|
-
constructor(client) {
|
|
5
|
-
this.#client = client;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get(id = null) { return id ? this.#client.get(`/configs/${id}`) : this.#client.get('/configs'); }
|
|
9
|
-
create(data) { return this.#client.put('/configs', data); }
|
|
10
|
-
edit(id, data) { return this.#client.patch(`/configs/${id}`, data); }
|
|
11
|
-
delete(id) { return this.#client.del(`/configs/${id}`); }
|
|
12
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
api
|
|
3
|
-
} from '../../../helpers.js';
|
|
4
|
-
|
|
5
|
-
describe('api/v1/categories', () => {
|
|
6
|
-
test('get', async () => {
|
|
7
|
-
await api.categories.get()
|
|
8
|
-
.then(response => {
|
|
9
|
-
response = Object.values(response);
|
|
10
|
-
expect(response.length > 0).toBe(true);
|
|
11
|
-
response.forEach(category => {
|
|
12
|
-
expect(category["id"]).toBeDefined();
|
|
13
|
-
expect(category["cod"]).toBeDefined();
|
|
14
|
-
expect(category["title"]).toBeDefined();
|
|
15
|
-
expect(category["enabled"]).toBeDefined();
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
api,
|
|
3
|
-
loginCustomer,
|
|
4
|
-
loginAdmin
|
|
5
|
-
} from '../../../helpers.js';
|
|
6
|
-
|
|
7
|
-
describe('api/v1/configs', () => {
|
|
8
|
-
test('get', async () => {
|
|
9
|
-
await api.configs.get()
|
|
10
|
-
.then(response => {
|
|
11
|
-
response = Object.values(response);
|
|
12
|
-
expect(response.length > 0).toBe(true);
|
|
13
|
-
response.forEach(config => {
|
|
14
|
-
expect(config["id"]).toBeDefined();
|
|
15
|
-
expect(config["cod"]).toBeDefined();
|
|
16
|
-
expect(config["value"]).toBeDefined();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|