@insignia-education/api-sdk-js 0.9.22 → 0.9.24

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.
Files changed (163) hide show
  1. package/.env +1 -0
  2. package/.env.test +5 -0
  3. package/.github/workflows/npm-publish-github-packages.yml +0 -0
  4. package/LICENSE +0 -0
  5. package/README.md +0 -14
  6. package/babel.config.cjs +0 -0
  7. package/coverage/clover.xml +860 -0
  8. package/coverage/coverage-final.json +33 -0
  9. package/coverage/lcov-report/Accounts.js.html +151 -0
  10. package/coverage/lcov-report/Auth.js.html +130 -0
  11. package/coverage/lcov-report/Categories.js.html +121 -0
  12. package/coverage/lcov-report/Changelogs.js.html +118 -0
  13. package/coverage/lcov-report/Client.js.html +349 -0
  14. package/coverage/lcov-report/Configs.js.html +121 -0
  15. package/coverage/lcov-report/ContactForms.js.html +121 -0
  16. package/coverage/lcov-report/ConversationalTopics.js.html +121 -0
  17. package/coverage/lcov-report/Countries.js.html +112 -0
  18. package/coverage/lcov-report/Coupons.js.html +121 -0
  19. package/coverage/lcov-report/Courses.js.html +328 -0
  20. package/coverage/lcov-report/Currencies.js.html +115 -0
  21. package/coverage/lcov-report/Files.js.html +115 -0
  22. package/coverage/lcov-report/Forums.js.html +157 -0
  23. package/coverage/lcov-report/Hashes.js.html +118 -0
  24. package/coverage/lcov-report/Insignias.js.html +121 -0
  25. package/coverage/lcov-report/Languages.js.html +121 -0
  26. package/coverage/lcov-report/MailBlacklist.js.html +118 -0
  27. package/coverage/lcov-report/Organizations.js.html +118 -0
  28. package/coverage/lcov-report/Quizzes.js.html +181 -0
  29. package/coverage/lcov-report/ShortLinks.js.html +121 -0
  30. package/coverage/lcov-report/Surveys.js.html +181 -0
  31. package/coverage/lcov-report/Tags.js.html +121 -0
  32. package/coverage/lcov-report/Taxes.js.html +121 -0
  33. package/coverage/lcov-report/Teacher.js.html +196 -0
  34. package/coverage/lcov-report/Translations.js.html +121 -0
  35. package/coverage/lcov-report/UserTypes.js.html +121 -0
  36. package/coverage/lcov-report/Users.js.html +331 -0
  37. package/coverage/lcov-report/Zoom.js.html +154 -0
  38. package/coverage/lcov-report/base.css +224 -0
  39. package/coverage/lcov-report/block-navigation.js +87 -0
  40. package/coverage/lcov-report/favicon.png +0 -0
  41. package/coverage/lcov-report/index.html +161 -0
  42. package/coverage/lcov-report/prettify.css +1 -0
  43. package/coverage/lcov-report/prettify.js +2 -0
  44. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  45. package/coverage/lcov-report/sorter.js +210 -0
  46. package/coverage/lcov-report/src/Client.js.html +349 -0
  47. package/coverage/lcov-report/src/api/index.html +116 -0
  48. package/coverage/lcov-report/src/api/index.js.html +127 -0
  49. package/coverage/lcov-report/src/api/v1/Accounts.js.html +151 -0
  50. package/coverage/lcov-report/src/api/v1/Auth.js.html +130 -0
  51. package/coverage/lcov-report/src/api/v1/Categories.js.html +121 -0
  52. package/coverage/lcov-report/src/api/v1/Changelogs.js.html +118 -0
  53. package/coverage/lcov-report/src/api/v1/Configs.js.html +121 -0
  54. package/coverage/lcov-report/src/api/v1/ContactForms.js.html +121 -0
  55. package/coverage/lcov-report/src/api/v1/ConversationalTopics.js.html +121 -0
  56. package/coverage/lcov-report/src/api/v1/Countries.js.html +112 -0
  57. package/coverage/lcov-report/src/api/v1/Coupons.js.html +121 -0
  58. package/coverage/lcov-report/src/api/v1/Courses.js.html +355 -0
  59. package/coverage/lcov-report/src/api/v1/Currencies.js.html +115 -0
  60. package/coverage/lcov-report/src/api/v1/Files.js.html +115 -0
  61. package/coverage/lcov-report/src/api/v1/Forums.js.html +157 -0
  62. package/coverage/lcov-report/src/api/v1/Hashes.js.html +118 -0
  63. package/coverage/lcov-report/src/api/v1/Insignias.js.html +121 -0
  64. package/coverage/lcov-report/src/api/v1/Languages.js.html +121 -0
  65. package/coverage/lcov-report/src/api/v1/MailBlacklist.js.html +118 -0
  66. package/coverage/lcov-report/src/api/v1/Organizations.js.html +118 -0
  67. package/coverage/lcov-report/src/api/v1/PaymentMethods.js.html +112 -0
  68. package/coverage/lcov-report/src/api/v1/Quizzes.js.html +181 -0
  69. package/coverage/lcov-report/src/api/v1/ShortLinks.js.html +121 -0
  70. package/coverage/lcov-report/src/api/v1/Surveys.js.html +181 -0
  71. package/coverage/lcov-report/src/api/v1/Tags.js.html +121 -0
  72. package/coverage/lcov-report/src/api/v1/Taxes.js.html +121 -0
  73. package/coverage/lcov-report/src/api/v1/Teacher.js.html +196 -0
  74. package/coverage/lcov-report/src/api/v1/Translations.js.html +121 -0
  75. package/coverage/lcov-report/src/api/v1/UserTypes.js.html +121 -0
  76. package/coverage/lcov-report/src/api/v1/Users.js.html +334 -0
  77. package/coverage/lcov-report/src/api/v1/Zoom.js.html +124 -0
  78. package/coverage/lcov-report/src/api/v1/index.html +521 -0
  79. package/coverage/lcov-report/src/api/v1/index.js.html +295 -0
  80. package/coverage/lcov-report/src/index.html +131 -0
  81. package/coverage/lcov-report/src/index.js.html +109 -0
  82. package/coverage/lcov-report/tests/helpers.js.html +130 -0
  83. package/coverage/lcov-report/tests/index.html +116 -0
  84. package/coverage/lcov-report/tests/integration/cookieJar.js.html +229 -0
  85. package/coverage/lcov-report/tests/integration/index.html +116 -0
  86. package/coverage/lcov.info +1606 -0
  87. package/coverage/test-report.html +980 -0
  88. package/eslint.config.mjs +10 -0
  89. package/index.js +0 -0
  90. package/jest.config.mjs +10 -0
  91. package/package.json +1 -1
  92. package/scss/Services/_notification.scss +0 -0
  93. package/scss/index.scss +0 -0
  94. package/src/Client.js +55 -2
  95. package/src/api/index.js +0 -0
  96. package/src/api/v1/Accounts.js +0 -0
  97. package/src/api/v1/Auth.js +0 -0
  98. package/src/api/v1/Categories.js +0 -0
  99. package/src/api/v1/Changelogs.js +0 -0
  100. package/src/api/v1/Configs.js +0 -0
  101. package/src/api/v1/ContactForms.js +0 -0
  102. package/src/api/v1/ConversationalTopics.js +0 -0
  103. package/src/api/v1/Countries.js +0 -0
  104. package/src/api/v1/Coupons.js +0 -0
  105. package/src/api/v1/Courses.js +10 -1
  106. package/src/api/v1/Currencies.js +0 -0
  107. package/src/api/v1/Files.js +0 -0
  108. package/src/api/v1/Forums.js +0 -0
  109. package/src/api/v1/Hashes.js +0 -0
  110. package/src/api/v1/Insignias.js +0 -0
  111. package/src/api/v1/Languages.js +0 -0
  112. package/src/api/v1/MailBlacklist.js +0 -0
  113. package/src/api/v1/Organizations.js +0 -0
  114. package/src/api/v1/PaymentMethods.js +0 -0
  115. package/src/api/v1/Quizzes.js +0 -0
  116. package/src/api/v1/ShortLinks.js +0 -0
  117. package/src/api/v1/Surveys.js +0 -0
  118. package/src/api/v1/Taxes.js +0 -0
  119. package/src/api/v1/Teacher.js +0 -0
  120. package/src/api/v1/UserTypes.js +0 -0
  121. package/src/api/v1/Users.js +0 -0
  122. package/src/api/v1/Zoom.js +0 -10
  123. package/src/api/v1/index.js +1 -4
  124. package/src/index.js +0 -0
  125. package/tests/client.test.js +64 -1
  126. package/tests/helpers.js +16 -0
  127. package/tests/integration/api/v1/accounts.test.js +37 -0
  128. package/tests/integration/api/v1/auth/login.test.js +60 -0
  129. package/tests/integration/api/v1/categories.test.js +19 -0
  130. package/tests/integration/api/v1/changelogs.test.js +21 -0
  131. package/tests/integration/api/v1/configs.test.js +20 -0
  132. package/tests/integration/api/v1/contact-forms.test.js +24 -0
  133. package/tests/integration/api/v1/conversational-topics.test.js +19 -0
  134. package/tests/integration/api/v1/countries.test.js +20 -0
  135. package/tests/integration/api/v1/coupons.test.js +26 -0
  136. package/tests/integration/api/v1/courses/by-cod.test.js +19 -0
  137. package/tests/integration/api/v1/courses/index.test.js +46 -0
  138. package/tests/integration/api/v1/currencies/index.test.js +24 -0
  139. package/tests/integration/api/v1/currencies/values.test.js +24 -0
  140. package/tests/integration/api/v1/files.test.js +25 -0
  141. package/tests/integration/api/v1/forums/index.test.js +23 -0
  142. package/tests/integration/api/v1/hashes.test.js +26 -0
  143. package/tests/integration/api/v1/insignias.test.js +19 -0
  144. package/tests/integration/api/v1/languages.test.js +28 -0
  145. package/tests/integration/api/v1/mail-blacklist.test.js +26 -0
  146. package/tests/integration/api/v1/organizations.test.js +25 -0
  147. package/tests/integration/api/v1/payment-methods/by-currencies.test.js +51 -0
  148. package/tests/integration/api/v1/quizzes/index.test.js +39 -0
  149. package/tests/integration/api/v1/short-links.test.js +27 -0
  150. package/tests/integration/api/v1/surveys/index.test.js +40 -0
  151. package/tests/integration/api/v1/taxes.test.js +20 -0
  152. package/tests/integration/api/v1/teacher/index.test.js +53 -0
  153. package/tests/integration/api/v1/user-types.test.js +19 -0
  154. package/tests/integration/api/v1/users/cash-receivers.test.js +19 -0
  155. package/tests/integration/api/v1/users/index.test.js +35 -0
  156. package/tests/integration/api/v1/zoom.test.js +24 -0
  157. package/tests/integration/loadEnv.js +0 -0
  158. package/src/api/v1/Tags.js +0 -12
  159. package/src/api/v1/Translations.js +0 -12
  160. package/tests/api/v1.test.js +0 -480
  161. package/tests/integration/api.v1.test.js +0 -125
  162. package/tests/integration/auth.test.js +0 -40
  163. package/tests/integration/cookieJar.js +0 -48
@@ -1,480 +0,0 @@
1
- import Auth from '../../src/api/v1/Auth.js';
2
- import Accounts from '../../src/api/v1/Accounts.js';
3
- import Categories from '../../src/api/v1/Categories.js';
4
- import Changelogs from '../../src/api/v1/Changelogs.js';
5
- import Configs from '../../src/api/v1/Configs.js';
6
- import ContactForms from '../../src/api/v1/ContactForms.js';
7
- import ConversationalTopics from '../../src/api/v1/ConversationalTopics.js';
8
- import Countries from '../../src/api/v1/Countries.js';
9
- import Coupons from '../../src/api/v1/Coupons.js';
10
- import Courses from '../../src/api/v1/Courses.js';
11
- import Currencies from '../../src/api/v1/Currencies.js';
12
- import Files from '../../src/api/v1/Files.js';
13
- import Forums from '../../src/api/v1/Forums.js';
14
- import Hashes from '../../src/api/v1/Hashes.js';
15
- import Insignias from '../../src/api/v1/Insignias.js';
16
- import Languages from '../../src/api/v1/Languages.js';
17
- import MailBlacklist from '../../src/api/v1/MailBlacklist.js';
18
- import Organizations from '../../src/api/v1/Organizations.js';
19
- import Quizzes from '../../src/api/v1/Quizzes.js';
20
- import ShortLinks from '../../src/api/v1/ShortLinks.js';
21
- import Surveys from '../../src/api/v1/Surveys.js';
22
- import Tags from '../../src/api/v1/Tags.js';
23
- import Taxes from '../../src/api/v1/Taxes.js';
24
- import Teacher from '../../src/api/v1/Teacher.js';
25
- import Translations from '../../src/api/v1/Translations.js';
26
- import UserTypes from '../../src/api/v1/UserTypes.js';
27
- import Users from '../../src/api/v1/Users.js';
28
- import Zoom from '../../src/api/v1/Zoom.js';
29
-
30
- function mockClient() {
31
- return {
32
- get: jest.fn(),
33
- post: jest.fn(),
34
- put: jest.fn(),
35
- patch: jest.fn(),
36
- del: jest.fn(),
37
- };
38
- }
39
-
40
- // ─── Auth ─────────────────────────────────────────────────────────────────────
41
-
42
- describe('Auth', () => {
43
- let c, r;
44
- beforeEach(() => { c = mockClient(); r = new Auth(c); });
45
-
46
- test('loginOrRegister', () => { r.loginOrRegister('a@b.com'); expect(c.get).toHaveBeenCalledWith('/auth/login-register-check?email=a%40b.com'); });
47
- test('register', () => { r.register({}); expect(c.put).toHaveBeenCalledWith('/auth/register', {}); });
48
- test('login', () => { r.login({}); expect(c.post).toHaveBeenCalledWith('/auth/login', {}); });
49
- test('googleLogin', () => { r.googleLogin({}); expect(c.post).toHaveBeenCalledWith('/auth/google', {}); });
50
- test('refresh', () => { r.refresh(); expect(c.post).toHaveBeenCalledWith('/auth/refresh'); });
51
- test('logout', () => { r.logout(); expect(c.post).toHaveBeenCalledWith('/auth/logout'); });
52
- test('user', () => { r.user(); expect(c.get).toHaveBeenCalledWith('/auth/user'); });
53
- });
54
-
55
- // ─── Accounts ────────────────────────────────────────────────────────────────
56
-
57
- describe('Accounts', () => {
58
- let c, r;
59
- beforeEach(() => { c = mockClient(); r = new Accounts(c); });
60
-
61
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/accounts'); });
62
- test('get by id', () => { r.get(5); expect(c.get).toHaveBeenCalledWith('/accounts/5'); });
63
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/accounts', {}); });
64
- test('edit', () => { r.edit(5, {}); expect(c.patch).toHaveBeenCalledWith('/accounts/5', {}); });
65
- test('delete', () => { r.delete(5); expect(c.del).toHaveBeenCalledWith('/accounts/5'); });
66
-
67
- describe('moves()', () => {
68
- test('get all', () => { r.moves(3).get(); expect(c.get).toHaveBeenCalledWith('/accounts/3/moves'); });
69
- test('get by id', () => { r.moves(3).get(7); expect(c.get).toHaveBeenCalledWith('/accounts/3/moves/7'); });
70
- test('create', () => { r.moves(3).create({}); expect(c.put).toHaveBeenCalledWith('/accounts/3/moves', {}); });
71
- test('edit', () => { r.moves(3).edit(7, {}); expect(c.patch).toHaveBeenCalledWith('/accounts/3/moves/7', {}); });
72
- test('delete', () => { r.moves(3).delete(7); expect(c.del).toHaveBeenCalledWith('/accounts/3/moves/7'); });
73
- });
74
- });
75
-
76
- // ─── Simple CRUD resources ────────────────────────────────────────────────────
77
-
78
- const crudCases = [
79
- ['Categories', Categories, '/categories'],
80
- ['Configs', Configs, '/configs'],
81
- ['ConversationalTopics',ConversationalTopics,'/conversational-topics'],
82
- ['Coupons', Coupons, '/coupons'],
83
- ['Insignias', Insignias, '/insignias'],
84
- ['Languages', Languages, '/languages'],
85
- ['ShortLinks', ShortLinks, '/short-links'],
86
- ['Tags', Tags, '/tags'],
87
- ['Taxes', Taxes, '/taxes'],
88
- ['UserTypes', UserTypes, '/user-types'],
89
- ];
90
-
91
- crudCases.forEach(([name, Class, base]) => {
92
- describe(name, () => {
93
- let c, r;
94
- beforeEach(() => { c = mockClient(); r = new Class(c); });
95
-
96
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith(base); });
97
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith(`${base}/1`); });
98
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith(base, {}); });
99
- test('edit', () => { r.edit(1, {}); expect(c.patch).toHaveBeenCalledWith(`${base}/1`, {}); });
100
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith(`${base}/1`); });
101
- });
102
- });
103
-
104
- // ─── Changelogs ───────────────────────────────────────────────────────────────
105
-
106
- describe('Changelogs', () => {
107
- let c, r;
108
- beforeEach(() => { c = mockClient(); r = new Changelogs(c); });
109
-
110
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/changelogs'); });
111
- test('get by id',() => { r.get(1); expect(c.get).toHaveBeenCalledWith('/changelogs/1'); });
112
- test('approve', () => { r.approve(1); expect(c.post).toHaveBeenCalledWith('/changelogs/1/approve'); });
113
- test('reject', () => { r.reject(1, {}); expect(c.post).toHaveBeenCalledWith('/changelogs/1/reject', {}); });
114
- });
115
-
116
- // ─── ContactForms ─────────────────────────────────────────────────────────────
117
-
118
- describe('ContactForms', () => {
119
- let c, r;
120
- beforeEach(() => { c = mockClient(); r = new ContactForms(c); });
121
-
122
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/contact-forms'); });
123
- test('get by id',() => { r.get(1); expect(c.get).toHaveBeenCalledWith('/contact-forms/1'); });
124
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/contact-forms', {}); });
125
- test('answer', () => { r.answer(1, {}); expect(c.post).toHaveBeenCalledWith('/contact-forms/1/answer', {}); });
126
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/contact-forms/1'); });
127
- });
128
-
129
- // ─── Countries ────────────────────────────────────────────────────────────────
130
-
131
- describe('Countries', () => {
132
- let c, r;
133
- beforeEach(() => { c = mockClient(); r = new Countries(c); });
134
-
135
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/countries'); });
136
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/countries/1'); });
137
- });
138
-
139
- // ─── Currencies ───────────────────────────────────────────────────────────────
140
-
141
- describe('Currencies', () => {
142
- let c, r;
143
- beforeEach(() => { c = mockClient(); r = new Currencies(c); });
144
-
145
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/currencies'); });
146
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/currencies/1'); });
147
- test('getValues', () => { r.getValues();expect(c.get).toHaveBeenCalledWith('/currencies/values'); });
148
- });
149
-
150
- // ─── Files ────────────────────────────────────────────────────────────────────
151
-
152
- describe('Files', () => {
153
- let c, r;
154
- beforeEach(() => { c = mockClient(); r = new Files(c); });
155
-
156
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/files'); });
157
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/files/1'); });
158
- test('delete', () => { r.delete(1);expect(c.del).toHaveBeenCalledWith('/files/1'); });
159
- });
160
-
161
- // ─── Forums ───────────────────────────────────────────────────────────────────
162
-
163
- describe('Forums', () => {
164
- let c, r;
165
- beforeEach(() => { c = mockClient(); r = new Forums(c); });
166
-
167
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/forums'); });
168
- test('get by id',() => { r.get(1); expect(c.get).toHaveBeenCalledWith('/forums/1'); });
169
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/forums', {}); });
170
- test('edit', () => { r.edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/forums/1', {}); });
171
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/forums/1'); });
172
- test('approve', () => { r.approve(1); expect(c.post).toHaveBeenCalledWith('/forums/1/approve'); });
173
-
174
- describe('responses()', () => {
175
- test('get all', () => { r.responses(2).get(); expect(c.get).toHaveBeenCalledWith('/forums/2/responses'); });
176
- test('get by id', () => { r.responses(2).get(5); expect(c.get).toHaveBeenCalledWith('/forums/2/responses/5'); });
177
- test('create', () => { r.responses(2).create({}); expect(c.put).toHaveBeenCalledWith('/forums/2/responses', {}); });
178
- test('edit', () => { r.responses(2).edit(5, {}); expect(c.patch).toHaveBeenCalledWith('/forums/2/responses/5', {}); });
179
- test('delete', () => { r.responses(2).delete(5); expect(c.del).toHaveBeenCalledWith('/forums/2/responses/5'); });
180
- test('approve', () => { r.responses(2).approve(5); expect(c.post).toHaveBeenCalledWith('/forums/2/responses/5/approve'); });
181
- });
182
- });
183
-
184
- // ─── Hashes ───────────────────────────────────────────────────────────────────
185
-
186
- describe('Hashes', () => {
187
- let c, r;
188
- beforeEach(() => { c = mockClient(); r = new Hashes(c); });
189
-
190
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/hashes'); });
191
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/hashes/1'); });
192
- test('generate', () => { r.generate({}); expect(c.put).toHaveBeenCalledWith('/hashes/generate', {}); });
193
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/hashes/1'); });
194
- });
195
-
196
- // ─── MailBlacklist ────────────────────────────────────────────────────────────
197
-
198
- describe('MailBlacklist', () => {
199
- let c, r;
200
- beforeEach(() => { c = mockClient(); r = new MailBlacklist(c); });
201
-
202
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/mail-blacklist'); });
203
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/mail-blacklist/1'); });
204
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/mail-blacklist', {}); });
205
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/mail-blacklist/1'); });
206
- });
207
-
208
- // ─── Organizations ────────────────────────────────────────────────────────────
209
-
210
- describe('Organizations', () => {
211
- let c, r;
212
- beforeEach(() => { c = mockClient(); r = new Organizations(c); });
213
-
214
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/organizations'); });
215
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/organizations/1'); });
216
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/organizations', {}); });
217
- test('edit', () => { r.edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/organizations/1', {}); });
218
- });
219
-
220
- // ─── Translations ─────────────────────────────────────────────────────────────
221
-
222
- describe('Translations', () => {
223
- let c, r;
224
- beforeEach(() => { c = mockClient(); r = new Translations(c); });
225
-
226
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/translations'); });
227
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/translations/1'); });
228
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/translations', {}); });
229
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/translations/1'); });
230
- test('editText', () => { r.editText(1, {}); expect(c.patch).toHaveBeenCalledWith('/translations/1/text', {}); });
231
- });
232
-
233
- // ─── Courses (nested) ─────────────────────────────────────────────────────────
234
-
235
- describe('Courses', () => {
236
- let c, r;
237
- beforeEach(() => { c = mockClient(); r = new Courses(c); });
238
-
239
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/courses'); });
240
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/courses/1'); });
241
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/courses', {}); });
242
- test('edit', () => { r.edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1', {}); });
243
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/courses/1'); });
244
-
245
- describe('dates()', () => {
246
- test('get all', () => { r.dates(1).get(); expect(c.get).toHaveBeenCalledWith('/courses/1/dates'); });
247
- test('get by id', () => { r.dates(1).get(2); expect(c.get).toHaveBeenCalledWith('/courses/1/dates/2'); });
248
- test('create', () => { r.dates(1).create({}); expect(c.put).toHaveBeenCalledWith('/courses/1/dates', {}); });
249
- test('edit', () => { r.dates(1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1/dates/2', {}); });
250
- test('delete', () => { r.dates(1).delete(2); expect(c.del).toHaveBeenCalledWith('/courses/1/dates/2'); });
251
- });
252
-
253
- describe('sessions()', () => {
254
- test('get all', () => { r.sessions(1).get(); expect(c.get).toHaveBeenCalledWith('/courses/1/sessions'); });
255
- test('get by id', () => { r.sessions(1).get(2); expect(c.get).toHaveBeenCalledWith('/courses/1/sessions/2'); });
256
- test('create', () => { r.sessions(1).create({}); expect(c.put).toHaveBeenCalledWith('/courses/1/sessions', {}); });
257
- test('edit', () => { r.sessions(1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1/sessions/2', {}); });
258
- test('delete', () => { r.sessions(1).delete(2); expect(c.del).toHaveBeenCalledWith('/courses/1/sessions/2'); });
259
- });
260
-
261
- describe('premiums()', () => {
262
- test('get all', () => { r.premiums(1).get(); expect(c.get).toHaveBeenCalledWith('/courses/1/premiums'); });
263
- test('get by id', () => { r.premiums(1).get(2); expect(c.get).toHaveBeenCalledWith('/courses/1/premiums/2'); });
264
- test('create', () => { r.premiums(1).create({}); expect(c.put).toHaveBeenCalledWith('/courses/1/premiums', {}); });
265
- test('edit', () => { r.premiums(1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1/premiums/2', {}); });
266
- test('delete', () => { r.premiums(1).delete(2); expect(c.del).toHaveBeenCalledWith('/courses/1/premiums/2'); });
267
-
268
- describe('items()', () => {
269
- test('get all', () => { r.premiums(1).items(2).get(); expect(c.get).toHaveBeenCalledWith('/courses/1/premiums/2/items'); });
270
- test('get by id', () => { r.premiums(1).items(2).get(3); expect(c.get).toHaveBeenCalledWith('/courses/1/premiums/2/items/3'); });
271
- test('create', () => { r.premiums(1).items(2).create({}); expect(c.put).toHaveBeenCalledWith('/courses/1/premiums/2/items', {}); });
272
- test('edit', () => { r.premiums(1).items(2).edit(3, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1/premiums/2/items/3', {}); });
273
- test('delete', () => { r.premiums(1).items(2).delete(3); expect(c.del).toHaveBeenCalledWith('/courses/1/premiums/2/items/3'); });
274
- });
275
- });
276
-
277
- describe('levels()', () => {
278
- test('get all', () => { r.levels(1).get(); expect(c.get).toHaveBeenCalledWith('/courses/1/levels'); });
279
- test('get by id', () => { r.levels(1).get(2); expect(c.get).toHaveBeenCalledWith('/courses/1/levels/2'); });
280
- test('create', () => { r.levels(1).create({}); expect(c.put).toHaveBeenCalledWith('/courses/1/levels', {}); });
281
- test('edit', () => { r.levels(1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1/levels/2', {}); });
282
- test('delete', () => { r.levels(1).delete(2); expect(c.del).toHaveBeenCalledWith('/courses/1/levels/2'); });
283
-
284
- describe('lessons()', () => {
285
- test('get all', () => { r.levels(1).lessons(2).get(); expect(c.get).toHaveBeenCalledWith('/courses/1/levels/2/lessons'); });
286
- test('get by id', () => { r.levels(1).lessons(2).get(3); expect(c.get).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3'); });
287
- test('create', () => { r.levels(1).lessons(2).create({}); expect(c.put).toHaveBeenCalledWith('/courses/1/levels/2/lessons', {}); });
288
- test('edit', () => { r.levels(1).lessons(2).edit(3, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3', {}); });
289
- test('delete', () => { r.levels(1).lessons(2).delete(3); expect(c.del).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3'); });
290
-
291
- describe('materials()', () => {
292
- test('get all', () => { r.levels(1).lessons(2).materials(3).get(); expect(c.get).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3/materials'); });
293
- test('get by id', () => { r.levels(1).lessons(2).materials(3).get(4); expect(c.get).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3/materials/4'); });
294
- test('create', () => { r.levels(1).lessons(2).materials(3).create({}); expect(c.put).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3/materials', {}); });
295
- test('edit', () => { r.levels(1).lessons(2).materials(3).edit(4, {}); expect(c.patch).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3/materials/4', {}); });
296
- test('delete', () => { r.levels(1).lessons(2).materials(3).delete(4); expect(c.del).toHaveBeenCalledWith('/courses/1/levels/2/lessons/3/materials/4'); });
297
- });
298
- });
299
- });
300
- });
301
-
302
- // ─── Quizzes (nested) ─────────────────────────────────────────────────────────
303
-
304
- describe('Quizzes', () => {
305
- let c, r;
306
- beforeEach(() => { c = mockClient(); r = new Quizzes(c); });
307
-
308
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/quizzes'); });
309
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/quizzes/1'); });
310
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/quizzes', {}); });
311
- test('edit', () => { r.edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/quizzes/1', {}); });
312
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/quizzes/1'); });
313
-
314
- describe('questions()', () => {
315
- test('get all', () => { r.questions(1).get(); expect(c.get).toHaveBeenCalledWith('/quizzes/1/questions'); });
316
- test('get by id', () => { r.questions(1).get(2); expect(c.get).toHaveBeenCalledWith('/quizzes/1/questions/2'); });
317
- test('create', () => { r.questions(1).create({}); expect(c.put).toHaveBeenCalledWith('/quizzes/1/questions', {}); });
318
- test('edit', () => { r.questions(1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith('/quizzes/1/questions/2', {}); });
319
- test('delete', () => { r.questions(1).delete(2); expect(c.del).toHaveBeenCalledWith('/quizzes/1/questions/2'); });
320
-
321
- describe('answers()', () => {
322
- test('get all', () => { r.questions(1).answers(2).get(); expect(c.get).toHaveBeenCalledWith('/quizzes/1/questions/2/answers'); });
323
- test('get by id', () => { r.questions(1).answers(2).get(3); expect(c.get).toHaveBeenCalledWith('/quizzes/1/questions/2/answers/3'); });
324
- test('create', () => { r.questions(1).answers(2).create({}); expect(c.put).toHaveBeenCalledWith('/quizzes/1/questions/2/answers', {}); });
325
- test('edit', () => { r.questions(1).answers(2).edit(3, {}); expect(c.patch).toHaveBeenCalledWith('/quizzes/1/questions/2/answers/3', {}); });
326
- test('delete', () => { r.questions(1).answers(2).delete(3); expect(c.del).toHaveBeenCalledWith('/quizzes/1/questions/2/answers/3'); });
327
- });
328
- });
329
- });
330
-
331
- // ─── Surveys (nested) ─────────────────────────────────────────────────────────
332
-
333
- describe('Surveys', () => {
334
- let c, r;
335
- beforeEach(() => { c = mockClient(); r = new Surveys(c); });
336
-
337
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/surveys'); });
338
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/surveys/1'); });
339
- test('create', () => { r.create({}); expect(c.put).toHaveBeenCalledWith('/surveys', {}); });
340
- test('edit', () => { r.edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/surveys/1', {}); });
341
- test('delete', () => { r.delete(1); expect(c.del).toHaveBeenCalledWith('/surveys/1'); });
342
-
343
- describe('questions()', () => {
344
- test('get all', () => { r.questions(1).get(); expect(c.get).toHaveBeenCalledWith('/surveys/1/questions'); });
345
- test('get by id', () => { r.questions(1).get(2); expect(c.get).toHaveBeenCalledWith('/surveys/1/questions/2'); });
346
- test('create', () => { r.questions(1).create({}); expect(c.put).toHaveBeenCalledWith('/surveys/1/questions', {}); });
347
- test('edit', () => { r.questions(1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith('/surveys/1/questions/2', {}); });
348
- test('delete', () => { r.questions(1).delete(2); expect(c.del).toHaveBeenCalledWith('/surveys/1/questions/2'); });
349
-
350
- describe('answers()', () => {
351
- test('get all', () => { r.questions(1).answers(2).get(); expect(c.get).toHaveBeenCalledWith('/surveys/1/questions/2/answers'); });
352
- test('get by id', () => { r.questions(1).answers(2).get(3); expect(c.get).toHaveBeenCalledWith('/surveys/1/questions/2/answers/3'); });
353
- test('create', () => { r.questions(1).answers(2).create({}); expect(c.put).toHaveBeenCalledWith('/surveys/1/questions/2/answers', {}); });
354
- test('edit', () => { r.questions(1).answers(2).edit(3, {}); expect(c.patch).toHaveBeenCalledWith('/surveys/1/questions/2/answers/3', {}); });
355
- test('delete', () => { r.questions(1).answers(2).delete(3); expect(c.del).toHaveBeenCalledWith('/surveys/1/questions/2/answers/3'); });
356
- });
357
- });
358
- });
359
-
360
- // ─── Teacher ─────────────────────────────────────────────────────────────────
361
-
362
- describe('Teacher', () => {
363
- let c, r;
364
- beforeEach(() => { c = mockClient(); r = new Teacher(c); });
365
-
366
- describe('absences()', () => {
367
- test('get all', () => { r.absences().get(); expect(c.get).toHaveBeenCalledWith('/teacher/absences'); });
368
- test('get by id', () => { r.absences().get(1); expect(c.get).toHaveBeenCalledWith('/teacher/absences/1'); });
369
- test('create', () => { r.absences().create({}); expect(c.put).toHaveBeenCalledWith('/teacher/absences', {}); });
370
- test('edit', () => { r.absences().edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/teacher/absences/1', {}); });
371
- test('delete', () => { r.absences().delete(1); expect(c.del).toHaveBeenCalledWith('/teacher/absences/1'); });
372
- });
373
-
374
- describe('configSets()', () => {
375
- test('get all', () => { r.configSets().get(); expect(c.get).toHaveBeenCalledWith('/teacher/config-sets'); });
376
- test('get by id', () => { r.configSets().get(1); expect(c.get).toHaveBeenCalledWith('/teacher/config-sets/1'); });
377
- test('create', () => { r.configSets().create({}); expect(c.put).toHaveBeenCalledWith('/teacher/config-sets', {}); });
378
- test('edit', () => { r.configSets().edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/teacher/config-sets/1', {}); });
379
- test('delete', () => { r.configSets().delete(1); expect(c.del).toHaveBeenCalledWith('/teacher/config-sets/1'); });
380
- });
381
-
382
- describe('configs()', () => {
383
- test('get all', () => { r.configs().get(); expect(c.get).toHaveBeenCalledWith('/teacher/configs'); });
384
- test('get by id', () => { r.configs().get(1); expect(c.get).toHaveBeenCalledWith('/teacher/configs/1'); });
385
- test('create', () => { r.configs().create({}); expect(c.put).toHaveBeenCalledWith('/teacher/configs', {}); });
386
- test('edit', () => { r.configs().edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/teacher/configs/1', {}); });
387
- test('delete', () => { r.configs().delete(1); expect(c.del).toHaveBeenCalledWith('/teacher/configs/1'); });
388
- });
389
- });
390
-
391
- // ─── Users (nested) ───────────────────────────────────────────────────────────
392
-
393
- describe('Users', () => {
394
- let c, r;
395
- beforeEach(() => { c = mockClient(); r = new Users(c); });
396
-
397
- test('get all', () => { r.get(); expect(c.get).toHaveBeenCalledWith('/users'); });
398
- test('get by id', () => { r.get(1); expect(c.get).toHaveBeenCalledWith('/users/1'); });
399
- test('edit', () => { r.edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/users/1', {}); });
400
-
401
- const nestedPaths = [
402
- ['courses', 'courses'],
403
- ['courseNotes','course-notes'],
404
- ['quizzes', 'quizzes'],
405
- ['sessions', 'sessions'],
406
- ['surveys', 'surveys'],
407
- ['cart', 'cart'],
408
- ];
409
-
410
- nestedPaths.forEach(([method, path]) => {
411
- describe(`${method}()`, () => {
412
- test('get all', () => { r[method](1).get(); expect(c.get).toHaveBeenCalledWith(`/users/1/${path}`); });
413
- test('get by id', () => { r[method](1).get(2); expect(c.get).toHaveBeenCalledWith(`/users/1/${path}/2`); });
414
- test('create', () => { r[method](1).create({}); expect(c.put).toHaveBeenCalledWith(`/users/1/${path}`, {}); });
415
- test('edit', () => { r[method](1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith(`/users/1/${path}/2`, {}); });
416
- test('delete', () => { r[method](1).delete(2); expect(c.del).toHaveBeenCalledWith(`/users/1/${path}/2`); });
417
- });
418
- });
419
-
420
- describe('payments()', () => {
421
- test('get all', () => { r.payments(1).get(); expect(c.get).toHaveBeenCalledWith('/users/1/payments'); });
422
- test('get by id', () => { r.payments(1).get(2); expect(c.get).toHaveBeenCalledWith('/users/1/payments/2'); });
423
- test('create', () => { r.payments(1).create({}); expect(c.put).toHaveBeenCalledWith('/users/1/payments', {}); });
424
- test('edit', () => { r.payments(1).edit(2, {}); expect(c.patch).toHaveBeenCalledWith('/users/1/payments/2', {}); });
425
- test('delete', () => { r.payments(1).delete(2); expect(c.del).toHaveBeenCalledWith('/users/1/payments/2'); });
426
- test('verify', () => { r.payments(1).verify(2); expect(c.post).toHaveBeenCalledWith('/users/1/payments/2/verify'); });
427
- test('reject', () => { r.payments(1).reject(2, {}); expect(c.post).toHaveBeenCalledWith('/users/1/payments/2/reject', {}); });
428
- });
429
-
430
- describe('points()', () => {
431
- test('get all', () => { r.points(1).get(); expect(c.get).toHaveBeenCalledWith('/users/1/points'); });
432
- test('get by id', () => { r.points(1).get(2); expect(c.get).toHaveBeenCalledWith('/users/1/points/2'); });
433
- test('create', () => { r.points(1).create({}); expect(c.put).toHaveBeenCalledWith('/users/1/points', {}); });
434
- test('delete', () => { r.points(1).delete(2); expect(c.del).toHaveBeenCalledWith('/users/1/points/2'); });
435
- });
436
-
437
- describe('moneyMoves()', () => {
438
- test('get all', () => { r.moneyMoves(1).get(); expect(c.get).toHaveBeenCalledWith('/users/1/money-moves'); });
439
- test('get by id', () => { r.moneyMoves(1).get(2); expect(c.get).toHaveBeenCalledWith('/users/1/money-moves/2'); });
440
- test('create', () => { r.moneyMoves(1).create({}); expect(c.put).toHaveBeenCalledWith('/users/1/money-moves', {}); });
441
- });
442
-
443
- describe('statistics()', () => {
444
- test('get', () => { r.statistics(1).get(); expect(c.get).toHaveBeenCalledWith('/users/1/statistics'); });
445
- });
446
-
447
- describe('organizations()', () => {
448
- test('get all', () => { r.organizations(1).get(); expect(c.get).toHaveBeenCalledWith('/users/1/organizations'); });
449
- test('get by id', () => { r.organizations(1).get(2); expect(c.get).toHaveBeenCalledWith('/users/1/organizations/2'); });
450
- test('create', () => { r.organizations(1).create({}); expect(c.put).toHaveBeenCalledWith('/users/1/organizations', {}); });
451
- test('delete', () => { r.organizations(1).delete(2); expect(c.del).toHaveBeenCalledWith('/users/1/organizations/2'); });
452
- });
453
-
454
- describe('pushEndpoints()', () => {
455
- test('get all', () => { r.pushEndpoints(1).get(); expect(c.get).toHaveBeenCalledWith('/users/1/push-endpoints'); });
456
- test('get by id', () => { r.pushEndpoints(1).get(2); expect(c.get).toHaveBeenCalledWith('/users/1/push-endpoints/2'); });
457
- test('create', () => { r.pushEndpoints(1).create({}); expect(c.put).toHaveBeenCalledWith('/users/1/push-endpoints', {}); });
458
- test('delete', () => { r.pushEndpoints(1).delete(2); expect(c.del).toHaveBeenCalledWith('/users/1/push-endpoints/2'); });
459
- });
460
- });
461
-
462
- // ─── Zoom ─────────────────────────────────────────────────────────────────────
463
-
464
- describe('Zoom', () => {
465
- let c, r;
466
- beforeEach(() => { c = mockClient(); r = new Zoom(c); });
467
-
468
- describe('meetings()', () => {
469
- test('get all', () => { r.meetings().get(); expect(c.get).toHaveBeenCalledWith('/zoom/meetings'); });
470
- test('get by id', () => { r.meetings().get(1); expect(c.get).toHaveBeenCalledWith('/zoom/meetings/1'); });
471
- });
472
-
473
- describe('tokens()', () => {
474
- test('get all', () => { r.tokens().get(); expect(c.get).toHaveBeenCalledWith('/zoom/tokens'); });
475
- test('get by id', () => { r.tokens().get(1); expect(c.get).toHaveBeenCalledWith('/zoom/tokens/1'); });
476
- test('create', () => { r.tokens().create({}); expect(c.put).toHaveBeenCalledWith('/zoom/tokens', {}); });
477
- test('edit', () => { r.tokens().edit(1, {}); expect(c.patch).toHaveBeenCalledWith('/zoom/tokens/1', {}); });
478
- test('delete', () => { r.tokens().delete(1); expect(c.del).toHaveBeenCalledWith('/zoom/tokens/1'); });
479
- });
480
- });
@@ -1,125 +0,0 @@
1
- import './cookieJar.js';
2
- import InsigniaApiV1 from '../../src/api/v1/index.js';
3
-
4
- const api = new InsigniaApiV1(process.env.INSIGNIA_EDUCATION_API_BASE_URL);
5
- beforeAll(async () => {
6
- const email = process.env.TEST_EMAIL;
7
- const password = process.env.TEST_PASSWORD;
8
- const login = await api.auth.login({ email, password });
9
- });
10
-
11
- afterAll(async () => {
12
- await api.auth.logout();
13
- });
14
-
15
- // ─── Read-only endpoints ──────────────────────────────────────────────────────
16
- describe('Countries', () => {
17
- test('get() returns a list', async () => {
18
- api.countries.get()
19
- .then(response => {
20
- expect(response["11"]).toBeDefined();
21
- expect(response["11"]["id"]).toBeDefined();
22
- expect(response["11"]["cod"]).toBeDefined();
23
- expect(response["11"]["domain"]).toBeDefined();
24
- expect(response["11"]["phone_prefix"]).toBeDefined();
25
- });
26
- });
27
- });
28
-
29
- describe('Currencies', () => {
30
- test('get() returns a list', async () => {
31
- api.currencies.get()
32
- .then(response => {
33
- expect(response["1"]).toBeDefined();
34
- expect(response["1"]["id"]).toBeDefined();
35
- expect(response["1"]["country_id"]).toBeDefined();
36
- expect(response["1"]["cod"]).toBeDefined();
37
- expect(response["1"]["title"]).toBeDefined();
38
- expect(response["1"]["enabled"]).toBeDefined();
39
- expect(response["1"]["has_double_expression"]).toBeDefined();
40
- expect(response["1"]["double_expression_by"]).toBeDefined();
41
- expect(response["1"]["created_at"]).toBeDefined();
42
- expect(response["1"]["updated_at"]).toBeDefined();
43
- expect(response["1"]["deleted_at"]).toBeDefined();
44
- });
45
- });
46
-
47
- test('getValues() returns exchange values', async () => {
48
- const res = await api.currencies.getValues()
49
- .then(response => {
50
- expect(response["USD"]).toBeDefined();
51
- expect(response["USD"]["id"]).toBeDefined();
52
- expect(response["USD"]["currency_id"]).toBeDefined();
53
- expect(response["USD"]["value"]).toBeDefined();
54
- expect(response["USD"]["created_at"]).toBeDefined();
55
- expect(response["USD"]["updated_at"]).toBeDefined();
56
- });
57
- });
58
- });
59
-
60
- describe('Languages', () => {
61
- test('get() returns a list', async () => {
62
- const res = await api.languages.get()
63
- .then(response => {
64
- expect(response["1"]).toBeDefined();
65
- expect(response["1"]["id"]).toBeDefined();
66
- expect(response["1"]["iso"]).toBeDefined();
67
- expect(response["1"]["flag_emoji"]).toBeDefined();
68
- expect(response["1"]["enabled"]).toBeDefined();
69
- expect(response["1"]["default"]).toBeDefined();
70
- expect(response["1"]["created_at"]).toBeDefined();
71
- expect(response["1"]["updated_at"]).toBeDefined();
72
- expect(response["1"]["deleted_at"]).toBeDefined();
73
- });
74
- });
75
- });
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
-
93
- describe('PaymentMethods', () => {
94
- test('get By currency id() returns a list', async () => {
95
- await api.currencies.get()
96
- .then(response => {
97
- Object.values(response).forEach(async currency => {
98
- await api.paymentMethods.byCurrency(currency.id)
99
- .then(response => {
100
- response = Object.values(response);
101
- if(response.length == 0){
102
- return;
103
- }
104
- expect(response[0]["id"]).toBeDefined();
105
- expect(response[0]["currency_id"]).toBeDefined();
106
- expect(response[0]["order"]).toBeDefined();
107
- expect(response[0]["cod"]).toBeDefined();
108
- expect(response[0]["title"]).toBeDefined();
109
- expect(response[0]["requires_reference"]).toBeDefined();
110
- expect(response[0]["can_upload_support"]).toBeDefined();
111
- expect(response[0]["enabled"]).toBeDefined();
112
- expect(response[0]["commission_amount"]).toBeDefined();
113
- expect(response[0]["commission_percentage"]).toBeDefined();
114
- expect(response[0]["description"]).toBeDefined();
115
- expect(response[0]["image"]).toBeDefined();
116
- expect(response[0]["icon"]).toBeDefined();
117
- expect(response[0]["created_at"]).toBeDefined();
118
- expect(response[0]["updated_at"]).toBeDefined();
119
- expect(response[0]["deleted_at"]).toBeDefined();
120
- })
121
- })
122
- })
123
- });
124
- });
125
-