@insignia-education/api-sdk-js 0.15.72 → 0.15.74
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 +7 -2
- package/src/api/v1/Courses.js +4 -4
- package/src/api/v1/Employee.js +2 -0
- package/src/api/v1/Users.js +7 -0
- package/.ai/guidelines/research-order.md +0 -29
- package/.claude/agents/product-spec-architect.md +0 -163
- package/.claude/agents/senior-code-reviewer.md +0 -109
- package/.claude/agents/senior-software-developer.md +0 -90
- package/.claude/agents/senior-software-maintainer.md +0 -121
- package/.claude/skills/general/documentation/SKILL.md +0 -49
- package/.claude/skills/general/handoff/SKILL.md +0 -15
- package/.claude/skills/general/investigation/SKILL.md +0 -53
- package/.claude/skills/general/performance/SKILL.md +0 -31
- package/.claude/skills/git/pull-request/SKILL.md +0 -47
- package/.claude/skills/how-to-create-skills/SKILL.md +0 -82
- package/.env +0 -1
- package/.env.test +0 -5
- package/.github/hooks/pre-commit +0 -22
- package/.github/workflows/npm-publish-github-packages.yml +0 -29
- package/.nvmrc +0 -1
- package/AGENTS.md +0 -140
- package/CLAUDE.md +0 -51
- package/babel.config.cjs +0 -1
- package/coverage/clover.xml +0 -380
- package/coverage/coverage-final.json +0 -3
- package/coverage/lcov-report/Client.js.html +0 -463
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/src/Client.js.html +0 -478
- package/coverage/lcov-report/src/api/index.html +0 -116
- package/coverage/lcov-report/src/api/index.js.html +0 -127
- package/coverage/lcov-report/src/api/v1/Accounts.js.html +0 -151
- package/coverage/lcov-report/src/api/v1/Admin.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Auth.js.html +0 -157
- package/coverage/lcov-report/src/api/v1/Categories.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Changelogs.js.html +0 -118
- package/coverage/lcov-report/src/api/v1/Configs.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/ContactForms.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/ConversationalTopics.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Countries.js.html +0 -112
- package/coverage/lcov-report/src/api/v1/Coupons.js.html +0 -175
- package/coverage/lcov-report/src/api/v1/Courses.js.html +0 -460
- package/coverage/lcov-report/src/api/v1/Currencies.js.html +0 -118
- package/coverage/lcov-report/src/api/v1/Dashboard.js.html +0 -115
- package/coverage/lcov-report/src/api/v1/EducationCenter.js.html +0 -115
- package/coverage/lcov-report/src/api/v1/Employee.js.html +0 -169
- package/coverage/lcov-report/src/api/v1/Files.js.html +0 -160
- package/coverage/lcov-report/src/api/v1/Forums.js.html +0 -175
- package/coverage/lcov-report/src/api/v1/Hashes.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Insignias.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Languages.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/MailBlacklist.js.html +0 -118
- package/coverage/lcov-report/src/api/v1/MailingLists.js.html +0 -127
- package/coverage/lcov-report/src/api/v1/Offers.js.html +0 -142
- package/coverage/lcov-report/src/api/v1/Organizations.js.html +0 -199
- package/coverage/lcov-report/src/api/v1/PaymentMethods.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Payments.js.html +0 -310
- package/coverage/lcov-report/src/api/v1/Premiums.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Quizzes.js.html +0 -214
- package/coverage/lcov-report/src/api/v1/Sales.js.html +0 -157
- package/coverage/lcov-report/src/api/v1/Search.js.html +0 -115
- package/coverage/lcov-report/src/api/v1/ShortLinks.js.html +0 -127
- package/coverage/lcov-report/src/api/v1/Surveys.js.html +0 -181
- package/coverage/lcov-report/src/api/v1/Taxes.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Teacher.js.html +0 -322
- package/coverage/lcov-report/src/api/v1/Telegram.js.html +0 -142
- package/coverage/lcov-report/src/api/v1/TwoFactor.js.html +0 -145
- package/coverage/lcov-report/src/api/v1/UserSessionTypes.js.html +0 -112
- package/coverage/lcov-report/src/api/v1/UserTypes.js.html +0 -121
- package/coverage/lcov-report/src/api/v1/Users.js.html +0 -778
- package/coverage/lcov-report/src/api/v1/Utm.js.html +0 -151
- package/coverage/lcov-report/src/api/v1/Webauthn.js.html +0 -190
- package/coverage/lcov-report/src/api/v1/Zoom.js.html +0 -124
- package/coverage/lcov-report/src/api/v1/index.html +0 -116
- package/coverage/lcov-report/src/api/v1/index.js.html +0 -373
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/src/index.js.html +0 -109
- package/coverage/lcov-report/tests/helpers.js.html +0 -145
- package/coverage/lcov-report/tests/index.html +0 -116
- package/coverage/lcov.info +0 -553
- package/coverage/test-report.html +0 -277
- package/eslint.config.mjs +0 -29
- package/jest.config.mjs +0 -47
- package/scss/Services/_notification.scss +0 -0
- package/scss/index.scss +0 -2
- package/tests/client.test.js +0 -265
- package/tests/helpers.js +0 -21
- package/tests/integration/api/v1/accounts.test.js +0 -31
- package/tests/integration/api/v1/auth/login.test.js +0 -44
- package/tests/integration/api/v1/changelogs.test.js +0 -21
- package/tests/integration/api/v1/contact-forms.test.js +0 -24
- package/tests/integration/api/v1/conversational-topics.test.js +0 -17
- package/tests/integration/api/v1/countries.test.js +0 -20
- package/tests/integration/api/v1/coupons.test.js +0 -19
- package/tests/integration/api/v1/courses/by-cod.test.js +0 -19
- package/tests/integration/api/v1/courses/index.test.js +0 -46
- package/tests/integration/api/v1/currencies/history.test.js +0 -23
- package/tests/integration/api/v1/currencies/index.test.js +0 -24
- package/tests/integration/api/v1/currencies/values.test.js +0 -24
- package/tests/integration/api/v1/files.test.js +0 -42
- package/tests/integration/api/v1/forums/index.test.js +0 -23
- package/tests/integration/api/v1/hashes.test.js +0 -18
- package/tests/integration/api/v1/insignias.test.js +0 -19
- package/tests/integration/api/v1/languages.test.js +0 -28
- package/tests/integration/api/v1/mail-blacklist.test.js +0 -19
- package/tests/integration/api/v1/offers.test.js +0 -20
- package/tests/integration/api/v1/organizations.test.js +0 -89
- package/tests/integration/api/v1/payment-methods/by-currencies.test.js +0 -51
- package/tests/integration/api/v1/quizzes/index.test.js +0 -37
- package/tests/integration/api/v1/short-links.test.js +0 -20
- package/tests/integration/api/v1/surveys/index.test.js +0 -40
- package/tests/integration/api/v1/taxes.test.js +0 -19
- package/tests/integration/api/v1/teacher/index.test.js +0 -53
- package/tests/integration/api/v1/telegram.test.js +0 -33
- package/tests/integration/api/v1/user-types.test.js +0 -17
- package/tests/integration/api/v1/users/cash-receivers.test.js +0 -19
- package/tests/integration/api/v1/users/index.test.js +0 -32
- package/tests/integration/api/v1/users/telegram.test.js +0 -36
- package/tests/integration/api/v1/zoom.test.js +0 -17
- package/tests/integration/loadEnv.js +0 -16
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
<html><head><meta charset="utf-8"/><title>API SDK Test Report</title><style type="text/css">:root {
|
|
2
|
-
--text-primary: #111;
|
|
3
|
-
--text-secondary: #4f4f4f;
|
|
4
|
-
--success: #006633;
|
|
5
|
-
--success-bright: #80ffbf;
|
|
6
|
-
--danger: #cc071e;
|
|
7
|
-
--danger-bright: #fbdfe0;
|
|
8
|
-
--warning: #995c00;
|
|
9
|
-
--warning-bright: #ffeea8;
|
|
10
|
-
--panel: #eee;
|
|
11
|
-
--border: #949494;
|
|
12
|
-
--disabled: #6b6b6b;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
html,
|
|
16
|
-
body {
|
|
17
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
18
|
-
font-size: 16px;
|
|
19
|
-
margin: 0;
|
|
20
|
-
padding: 0;
|
|
21
|
-
color: var(--text-primary);
|
|
22
|
-
}
|
|
23
|
-
body {
|
|
24
|
-
padding: 2rem 1rem;
|
|
25
|
-
}
|
|
26
|
-
.jesthtml-content {
|
|
27
|
-
margin: 0 auto;
|
|
28
|
-
max-width: 70rem;
|
|
29
|
-
}
|
|
30
|
-
header {
|
|
31
|
-
display: flex;
|
|
32
|
-
align-items: center;
|
|
33
|
-
}
|
|
34
|
-
#title {
|
|
35
|
-
margin: 0;
|
|
36
|
-
flex-grow: 1;
|
|
37
|
-
}
|
|
38
|
-
#logo {
|
|
39
|
-
height: 4rem;
|
|
40
|
-
}
|
|
41
|
-
#timestamp {
|
|
42
|
-
color: var(--text-secondary);
|
|
43
|
-
margin-top: 0.5rem;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
#metadata-container {
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
gap: 2rem;
|
|
50
|
-
margin-bottom: 2rem;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.additional-information-container {
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
gap: 0.5rem;
|
|
57
|
-
color: var(--text-secondary);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** SUMMARY */
|
|
61
|
-
#summary {
|
|
62
|
-
color: var(--text-primary);
|
|
63
|
-
display: flex;
|
|
64
|
-
font-family: monospace;
|
|
65
|
-
font-size: 1rem;
|
|
66
|
-
}
|
|
67
|
-
#summary > div {
|
|
68
|
-
margin-right: 0.5rem;
|
|
69
|
-
background: var(--panel);
|
|
70
|
-
padding: 1rem;
|
|
71
|
-
min-width: 15rem;
|
|
72
|
-
}
|
|
73
|
-
#summary > div:last-child {
|
|
74
|
-
margin-right: 0;
|
|
75
|
-
}
|
|
76
|
-
@media only screen and (max-width: 720px) {
|
|
77
|
-
#summary {
|
|
78
|
-
flex-direction: column;
|
|
79
|
-
}
|
|
80
|
-
#summary > div {
|
|
81
|
-
margin-right: 0;
|
|
82
|
-
margin-top: 1rem;
|
|
83
|
-
}
|
|
84
|
-
#summary > div:first-child {
|
|
85
|
-
margin-top: 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.summary-total {
|
|
90
|
-
font-weight: bold;
|
|
91
|
-
margin-bottom: 0.5rem;
|
|
92
|
-
}
|
|
93
|
-
.summary-passed {
|
|
94
|
-
color: var(--success);
|
|
95
|
-
border-left: 0.4rem solid var(--success);
|
|
96
|
-
padding-left: 0.5rem;
|
|
97
|
-
margin-bottom: 0.15rem;
|
|
98
|
-
}
|
|
99
|
-
.summary-failed,
|
|
100
|
-
.summary-obsolete-snapshots {
|
|
101
|
-
color: var(--danger);
|
|
102
|
-
border-left: 0.4rem solid var(--danger);
|
|
103
|
-
padding-left: 0.5rem;
|
|
104
|
-
margin-bottom: 0.15rem;
|
|
105
|
-
}
|
|
106
|
-
.summary-pending {
|
|
107
|
-
color: var(--warning);
|
|
108
|
-
border-left: 0.4rem solid var(--warning);
|
|
109
|
-
padding-left: 0.5rem;
|
|
110
|
-
margin-bottom: 0.15rem;
|
|
111
|
-
}
|
|
112
|
-
.summary-empty {
|
|
113
|
-
color: var(--disabled);
|
|
114
|
-
border-left: 0.4rem solid var(--disabled);
|
|
115
|
-
margin-bottom: 0.15rem;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.test-result {
|
|
119
|
-
padding: 1rem;
|
|
120
|
-
margin-bottom: 0.25rem;
|
|
121
|
-
}
|
|
122
|
-
.test-result:last-child {
|
|
123
|
-
border: 0;
|
|
124
|
-
}
|
|
125
|
-
.test-result.passed {
|
|
126
|
-
background-color: var(--success-bright);
|
|
127
|
-
color: var(--success);
|
|
128
|
-
}
|
|
129
|
-
.test-result.failed {
|
|
130
|
-
background-color: var(--danger-bright);
|
|
131
|
-
color: var(--danger);
|
|
132
|
-
}
|
|
133
|
-
.test-result.pending {
|
|
134
|
-
background-color: var(--warning-bright);
|
|
135
|
-
color: var(--warning);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.test-info {
|
|
139
|
-
display: flex;
|
|
140
|
-
justify-content: space-between;
|
|
141
|
-
}
|
|
142
|
-
.test-suitename {
|
|
143
|
-
width: 20%;
|
|
144
|
-
text-align: left;
|
|
145
|
-
font-weight: bold;
|
|
146
|
-
word-break: break-word;
|
|
147
|
-
}
|
|
148
|
-
.test-title {
|
|
149
|
-
width: 40%;
|
|
150
|
-
text-align: left;
|
|
151
|
-
font-style: italic;
|
|
152
|
-
}
|
|
153
|
-
.test-status {
|
|
154
|
-
width: 20%;
|
|
155
|
-
text-align: right;
|
|
156
|
-
}
|
|
157
|
-
.test-duration {
|
|
158
|
-
width: 10%;
|
|
159
|
-
text-align: right;
|
|
160
|
-
font-size: 0.85rem;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.failureMessages {
|
|
164
|
-
padding: 0 1rem;
|
|
165
|
-
margin-top: 1rem;
|
|
166
|
-
border-top: 1px dashed var(--danger);
|
|
167
|
-
}
|
|
168
|
-
.failureMessages.suiteFailure {
|
|
169
|
-
border-top: none;
|
|
170
|
-
}
|
|
171
|
-
.failureMsg {
|
|
172
|
-
white-space: pre-wrap;
|
|
173
|
-
white-space: -moz-pre-wrap;
|
|
174
|
-
white-space: -pre-wrap;
|
|
175
|
-
white-space: -o-pre-wrap;
|
|
176
|
-
word-wrap: break-word;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.suite-container {
|
|
180
|
-
margin-bottom: 1rem;
|
|
181
|
-
}
|
|
182
|
-
.suite-info {
|
|
183
|
-
padding: 1rem;
|
|
184
|
-
background-color: var(--panel);
|
|
185
|
-
color: var(--text-secondary);
|
|
186
|
-
border: 0.15rem solid;
|
|
187
|
-
border-color: var(--panel);
|
|
188
|
-
display: flex;
|
|
189
|
-
align-items: center;
|
|
190
|
-
margin-bottom: 0.25rem;
|
|
191
|
-
}
|
|
192
|
-
.suite-info:hover {
|
|
193
|
-
border-color: var(--border);
|
|
194
|
-
cursor: pointer;
|
|
195
|
-
}
|
|
196
|
-
.suite-info .suite-path {
|
|
197
|
-
word-break: break-all;
|
|
198
|
-
flex-grow: 1;
|
|
199
|
-
font-family: monospace;
|
|
200
|
-
font-size: 1rem;
|
|
201
|
-
}
|
|
202
|
-
.suite-info .suite-time {
|
|
203
|
-
margin-left: 1rem;
|
|
204
|
-
padding: 0.2rem 0.3rem;
|
|
205
|
-
font-size: 0.85rem;
|
|
206
|
-
}
|
|
207
|
-
.suite-info .suite-time.warn {
|
|
208
|
-
background-color: var(--danger);
|
|
209
|
-
color: #fff;
|
|
210
|
-
}
|
|
211
|
-
.suite-info:before {
|
|
212
|
-
content: "\2303";
|
|
213
|
-
display: inline-block;
|
|
214
|
-
margin-right: 1rem;
|
|
215
|
-
transform: rotate(180deg) translateY(0.15rem);
|
|
216
|
-
}
|
|
217
|
-
.suite-container[open] .suite-info:before {
|
|
218
|
-
transform: rotate(0deg) translateY(0.15rem);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
/* CONSOLE LOGS */
|
|
222
|
-
.suite-consolelog {
|
|
223
|
-
margin-bottom: 0.25rem;
|
|
224
|
-
padding: 1rem;
|
|
225
|
-
background-color: var(--panel);
|
|
226
|
-
}
|
|
227
|
-
.suite-consolelog-header {
|
|
228
|
-
font-weight: bold;
|
|
229
|
-
}
|
|
230
|
-
.suite-consolelog-item {
|
|
231
|
-
padding: 0.5rem;
|
|
232
|
-
}
|
|
233
|
-
.suite-consolelog-item pre {
|
|
234
|
-
margin: 0.5rem 0;
|
|
235
|
-
white-space: pre-wrap;
|
|
236
|
-
white-space: -moz-pre-wrap;
|
|
237
|
-
white-space: -pre-wrap;
|
|
238
|
-
white-space: -o-pre-wrap;
|
|
239
|
-
word-wrap: break-word;
|
|
240
|
-
}
|
|
241
|
-
.suite-consolelog-item-origin {
|
|
242
|
-
color: var(--text-secondary);
|
|
243
|
-
font-weight: bold;
|
|
244
|
-
}
|
|
245
|
-
.suite-consolelog-item-message {
|
|
246
|
-
color: var(--text-primary);
|
|
247
|
-
font-size: 1rem;
|
|
248
|
-
padding: 0 0.5rem;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/* OBSOLETE SNAPSHOTS */
|
|
252
|
-
.suite-obsolete-snapshots {
|
|
253
|
-
margin-bottom: 0.25rem;
|
|
254
|
-
padding: 1rem;
|
|
255
|
-
background-color: var(--danger-bright);
|
|
256
|
-
color: var(--danger);
|
|
257
|
-
}
|
|
258
|
-
.suite-obsolete-snapshots-header {
|
|
259
|
-
font-weight: bold;
|
|
260
|
-
}
|
|
261
|
-
.suite-obsolete-snapshots-item {
|
|
262
|
-
padding: 0.5rem;
|
|
263
|
-
}
|
|
264
|
-
.suite-obsolete-snapshots-item pre {
|
|
265
|
-
margin: 0.5rem 0;
|
|
266
|
-
white-space: pre-wrap;
|
|
267
|
-
white-space: -moz-pre-wrap;
|
|
268
|
-
white-space: -pre-wrap;
|
|
269
|
-
white-space: -o-pre-wrap;
|
|
270
|
-
word-wrap: break-word;
|
|
271
|
-
}
|
|
272
|
-
.suite-obsolete-snapshots-item-message {
|
|
273
|
-
color: var(--text-primary);
|
|
274
|
-
font-size: 1rem;
|
|
275
|
-
padding: 0 0.5rem;
|
|
276
|
-
}
|
|
277
|
-
</style></head><body><main class="jesthtml-content"><header><h1 id="title">API SDK Test Report</h1></header><section id="metadata-container"><div id="timestamp">Started: 2026-08-12 20:51:38</div><div id="summary"><div id="suite-summary"><div class="summary-total">Suites (1)</div><div class="summary-passed ">1 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div><div id="test-summary"><div class="summary-total">Tests (24)</div><div class="summary-passed ">24 passed</div><div class="summary-failed summary-empty">0 failed</div><div class="summary-pending summary-empty">0 pending</div></div></div></section><details id="suite-1" class="suite-container" open=""><summary class="suite-info"><div class="suite-path">/Users/roquendo/code/insignia-education/api-sdk-js/tests/client.test.js</div><div class="suite-time">0.518s</div></summary><div class="suite-tests"><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">uses explicit baseUrl when provided</div><div class="test-status">passed</div><div class="test-duration">0.003s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">strips trailing slash from explicit baseUrl</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">uses INSIGNIA_EDUCATION_API_BASE_URL env var when baseUrl is null</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">baseUrl getter exposes the resolved base URL</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">falls back to https://insigniaeducation.com when baseUrl is null and env var is not set</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">falls back to default when constructed with no arguments</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">explicit baseUrl takes precedence over env var</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">baseUrl resolution</div><div class="test-title">falls back to default when process is undefined</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">get() sends GET with no body</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">post() sends POST with body</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">post() sends POST with no body when not provided</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">put() sends PUT with body</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">put() sends PUT with no body when not provided</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">patch() sends PATCH with body</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">patch() sends PATCH with no body when not provided</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">del() sends DELETE with no body</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">JSON headers are always sent</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">credentials is always include</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">stores response cookies and sends them on later requests in Node</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">returns parsed JSON from response</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">returns null for empty response text</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">returns null for no-content responses</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">HTTP methods</div><div class="test-title">returns null when json parsing fails because the response is empty</div><div class="test-status">passed</div><div class="test-duration">0.001s</div></div></div><div class="test-result passed"><div class="test-info"><div class="test-suitename">Users.payments(userId).invoiceUrl</div><div class="test-title">builds a direct link to the invoice endpoint</div><div class="test-status">passed</div><div class="test-duration"> </div></div></div></div></details></main></body></html>
|
package/eslint.config.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
|
-
import globals from "globals";
|
|
3
|
-
|
|
4
|
-
export default [
|
|
5
|
-
js.configs.recommended,
|
|
6
|
-
{
|
|
7
|
-
files: ["src/**/*.js"],
|
|
8
|
-
languageOptions: {
|
|
9
|
-
globals: {
|
|
10
|
-
...globals.node,
|
|
11
|
-
fetch: "readonly",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
rules: {
|
|
15
|
-
"no-unused-vars": "warn",
|
|
16
|
-
"no-console": "warn",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
files: ["tests/**/*.js"],
|
|
21
|
-
languageOptions: {
|
|
22
|
-
globals: {
|
|
23
|
-
...globals.node,
|
|
24
|
-
...globals.jest,
|
|
25
|
-
fetch: "readonly",
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
];
|
package/jest.config.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/** @type {import('jest').Config} */
|
|
2
|
-
const config = {
|
|
3
|
-
collectCoverage: true,
|
|
4
|
-
coverageDirectory: 'coverage',
|
|
5
|
-
coverageProvider: 'v8',
|
|
6
|
-
|
|
7
|
-
reporters: [
|
|
8
|
-
'default',
|
|
9
|
-
['jest-html-reporter', {
|
|
10
|
-
outputPath: 'coverage/test-report.html',
|
|
11
|
-
pageTitle: 'API SDK Test Report',
|
|
12
|
-
includeFailureMsg: true,
|
|
13
|
-
includeConsoleLog: true,
|
|
14
|
-
}],
|
|
15
|
-
],
|
|
16
|
-
|
|
17
|
-
// Run via `npm test`, which invokes unit and integration as two separate
|
|
18
|
-
// `jest --selectProjects` calls (integration also with --runInBand)
|
|
19
|
-
// rather than one combined parallel run: Jest has a multi-project quirk
|
|
20
|
-
// where a later project's tests can silently fall back to the global
|
|
21
|
-
// 5000ms default instead of this project's own testTimeout when both
|
|
22
|
-
// projects run together in one process, and integration tests hit a
|
|
23
|
-
// single-threaded `php artisan serve` backend that serializes requests
|
|
24
|
-
// anyway — parallel workers just queue up and time out against it.
|
|
25
|
-
projects: [
|
|
26
|
-
{
|
|
27
|
-
displayName: 'unit',
|
|
28
|
-
testMatch: [
|
|
29
|
-
'<rootDir>/tests/client.test.js',
|
|
30
|
-
'<rootDir>/tests/api/**/*.test.js',
|
|
31
|
-
],
|
|
32
|
-
transform: { '^.+\\.(js|jsx)$': 'babel-jest' },
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
displayName: 'integration',
|
|
36
|
-
testMatch: ['<rootDir>/tests/integration/**/*.test.js'],
|
|
37
|
-
transform: { '^.+\\.(js|jsx)$': 'babel-jest' },
|
|
38
|
-
setupFiles: ['<rootDir>/tests/integration/loadEnv.js'],
|
|
39
|
-
// Generous — amd64 emulation (api-sdk-js's Docker test env on
|
|
40
|
-
// Apple Silicon) occasionally makes an individual request take
|
|
41
|
-
// 10-20s+ under CPU contention.
|
|
42
|
-
testTimeout: 60000,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default config;
|
|
File without changes
|
package/scss/index.scss
DELETED
package/tests/client.test.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import InsigniaClient from '../src/Client.js';
|
|
2
|
-
import Users from '../src/api/v1/Users.js';
|
|
3
|
-
|
|
4
|
-
const BASE = 'http://localhost:8000';
|
|
5
|
-
|
|
6
|
-
function mockFetch(json = {}) {
|
|
7
|
-
return jest.fn().mockResolvedValue({ ok: true, status: 200, json: () => Promise.resolve(json) });
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
delete process.env.INSIGNIA_EDUCATION_API_BASE_URL;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
afterEach(() => {
|
|
15
|
-
delete global.fetch;
|
|
16
|
-
delete process.env.INSIGNIA_EDUCATION_API_BASE_URL;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
// ─── baseUrl resolution ───────────────────────────────────────────────────────
|
|
20
|
-
|
|
21
|
-
describe('baseUrl resolution', () => {
|
|
22
|
-
test('uses explicit baseUrl when provided', async () => {
|
|
23
|
-
global.fetch = mockFetch();
|
|
24
|
-
const client = new InsigniaClient('https://custom.example.com');
|
|
25
|
-
await client.get('/test');
|
|
26
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
27
|
-
'https://custom.example.com/test',
|
|
28
|
-
expect.any(Object)
|
|
29
|
-
);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('strips trailing slash from explicit baseUrl', async () => {
|
|
33
|
-
global.fetch = mockFetch();
|
|
34
|
-
const client = new InsigniaClient('https://custom.example.com/');
|
|
35
|
-
await client.get('/test');
|
|
36
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
37
|
-
'https://custom.example.com/test',
|
|
38
|
-
expect.any(Object)
|
|
39
|
-
);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('uses INSIGNIA_EDUCATION_API_BASE_URL env var when baseUrl is null', async () => {
|
|
43
|
-
process.env.INSIGNIA_EDUCATION_API_BASE_URL = 'https://env.example.com';
|
|
44
|
-
global.fetch = mockFetch();
|
|
45
|
-
const client = new InsigniaClient(null);
|
|
46
|
-
await client.get('/test');
|
|
47
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
48
|
-
'https://env.example.com/test',
|
|
49
|
-
expect.any(Object)
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test('baseUrl getter exposes the resolved base URL', () => {
|
|
54
|
-
const client = new InsigniaClient('https://custom.example.com/');
|
|
55
|
-
expect(client.baseUrl).toBe('https://custom.example.com');
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test('falls back to https://insigniaeducation.com when baseUrl is null and env var is not set', async () => {
|
|
59
|
-
global.fetch = mockFetch();
|
|
60
|
-
const client = new InsigniaClient(null);
|
|
61
|
-
await client.get('/test');
|
|
62
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
63
|
-
'https://insigniaeducation.com/test',
|
|
64
|
-
expect.any(Object)
|
|
65
|
-
);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('falls back to default when constructed with no arguments', async () => {
|
|
69
|
-
global.fetch = mockFetch();
|
|
70
|
-
const client = new InsigniaClient();
|
|
71
|
-
await client.get('/test');
|
|
72
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
73
|
-
'https://insigniaeducation.com/test',
|
|
74
|
-
expect.any(Object)
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('explicit baseUrl takes precedence over env var', async () => {
|
|
79
|
-
process.env.INSIGNIA_EDUCATION_API_BASE_URL = 'https://env.example.com';
|
|
80
|
-
global.fetch = mockFetch();
|
|
81
|
-
const client = new InsigniaClient('https://explicit.example.com');
|
|
82
|
-
await client.get('/test');
|
|
83
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
84
|
-
'https://explicit.example.com/test',
|
|
85
|
-
expect.any(Object)
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('falls back to default when process is undefined', async () => {
|
|
90
|
-
const saved = global.process;
|
|
91
|
-
global.process = undefined;
|
|
92
|
-
global.fetch = mockFetch();
|
|
93
|
-
const client = new InsigniaClient(null);
|
|
94
|
-
await client.get('/test');
|
|
95
|
-
expect(global.fetch).toHaveBeenCalledWith(
|
|
96
|
-
'https://insigniaeducation.com/test',
|
|
97
|
-
expect.any(Object)
|
|
98
|
-
);
|
|
99
|
-
global.process = saved;
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
// ─── HTTP methods ─────────────────────────────────────────────────────────────
|
|
104
|
-
|
|
105
|
-
describe('HTTP methods', () => {
|
|
106
|
-
let client;
|
|
107
|
-
|
|
108
|
-
beforeEach(() => {
|
|
109
|
-
global.fetch = mockFetch();
|
|
110
|
-
client = new InsigniaClient(BASE);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
test('get() sends GET with no body', async () => {
|
|
114
|
-
await client.get('/path');
|
|
115
|
-
const [url, options] = global.fetch.mock.calls[0];
|
|
116
|
-
expect(url).toBe(`${BASE}/path`);
|
|
117
|
-
expect(options.method).toBe('GET');
|
|
118
|
-
expect(options.body).toBeUndefined();
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
test('post() sends POST with body', async () => {
|
|
122
|
-
await client.post('/path', { key: 'val' });
|
|
123
|
-
const [url, options] = global.fetch.mock.calls[0];
|
|
124
|
-
expect(url).toBe(`${BASE}/path`);
|
|
125
|
-
expect(options.method).toBe('POST');
|
|
126
|
-
expect(options.body).toBe(JSON.stringify({ key: 'val' }));
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
test('post() sends POST with no body when not provided', async () => {
|
|
130
|
-
await client.post('/path');
|
|
131
|
-
const [, options] = global.fetch.mock.calls[0];
|
|
132
|
-
expect(options.method).toBe('POST');
|
|
133
|
-
expect(options.body).toBeUndefined();
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
test('put() sends PUT with body', async () => {
|
|
137
|
-
await client.put('/path', { key: 'val' });
|
|
138
|
-
const [url, options] = global.fetch.mock.calls[0];
|
|
139
|
-
expect(url).toBe(`${BASE}/path`);
|
|
140
|
-
expect(options.method).toBe('PUT');
|
|
141
|
-
expect(options.body).toBe(JSON.stringify({ key: 'val' }));
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
test('put() sends PUT with no body when not provided', async () => {
|
|
145
|
-
await client.put('/path');
|
|
146
|
-
const [, options] = global.fetch.mock.calls[0];
|
|
147
|
-
expect(options.method).toBe('PUT');
|
|
148
|
-
expect(options.body).toBeUndefined();
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
test('patch() sends PATCH with body', async () => {
|
|
152
|
-
await client.patch('/path', { key: 'val' });
|
|
153
|
-
const [url, options] = global.fetch.mock.calls[0];
|
|
154
|
-
expect(url).toBe(`${BASE}/path`);
|
|
155
|
-
expect(options.method).toBe('PATCH');
|
|
156
|
-
expect(options.body).toBe(JSON.stringify({ key: 'val' }));
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
test('patch() sends PATCH with no body when not provided', async () => {
|
|
160
|
-
await client.patch('/path');
|
|
161
|
-
const [, options] = global.fetch.mock.calls[0];
|
|
162
|
-
expect(options.method).toBe('PATCH');
|
|
163
|
-
expect(options.body).toBeUndefined();
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
test('del() sends DELETE with no body', async () => {
|
|
167
|
-
await client.del('/path');
|
|
168
|
-
const [url, options] = global.fetch.mock.calls[0];
|
|
169
|
-
expect(url).toBe(`${BASE}/path`);
|
|
170
|
-
expect(options.method).toBe('DELETE');
|
|
171
|
-
expect(options.body).toBeUndefined();
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
test('JSON headers are always sent', async () => {
|
|
175
|
-
await client.get('/path');
|
|
176
|
-
const [, options] = global.fetch.mock.calls[0];
|
|
177
|
-
expect(options.headers.Accept).toBe('application/json');
|
|
178
|
-
expect(options.headers['Content-Type']).toBe('application/json');
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
test('credentials is always include', async () => {
|
|
182
|
-
await client.get('/path');
|
|
183
|
-
const [, options] = global.fetch.mock.calls[0];
|
|
184
|
-
expect(options.credentials).toBe('include');
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
test('stores response cookies and sends them on later requests in Node', async () => {
|
|
188
|
-
global.fetch = jest.fn()
|
|
189
|
-
.mockResolvedValueOnce({
|
|
190
|
-
ok: true,
|
|
191
|
-
status: 200,
|
|
192
|
-
headers: {
|
|
193
|
-
getSetCookie: () => ['token=abc123; Path=/; HttpOnly; Secure; SameSite=Lax'],
|
|
194
|
-
},
|
|
195
|
-
json: () => Promise.resolve({ success: 'ok' }),
|
|
196
|
-
})
|
|
197
|
-
.mockResolvedValueOnce({
|
|
198
|
-
ok: true,
|
|
199
|
-
status: 200,
|
|
200
|
-
json: () => Promise.resolve({ id: 1, title: 'test' }),
|
|
201
|
-
});
|
|
202
|
-
client = new InsigniaClient(BASE);
|
|
203
|
-
|
|
204
|
-
await client.post('/auth/login', { email: 'admin@example.com', password: 'secret' });
|
|
205
|
-
await client.get('/accounts');
|
|
206
|
-
|
|
207
|
-
const [, options] = global.fetch.mock.calls[1];
|
|
208
|
-
expect(options.headers.Cookie).toBe('token=abc123');
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
test('returns parsed JSON from response', async () => {
|
|
212
|
-
global.fetch = jest.fn().mockResolvedValue({
|
|
213
|
-
ok: true,
|
|
214
|
-
status: 200,
|
|
215
|
-
json: () => Promise.resolve({ id: 1, name: 'test' }),
|
|
216
|
-
});
|
|
217
|
-
client = new InsigniaClient(BASE);
|
|
218
|
-
const result = await client.get('/path');
|
|
219
|
-
expect(result).toEqual({ id: 1, name: 'test' });
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
test('returns null for empty response text', async () => {
|
|
223
|
-
global.fetch = jest.fn().mockResolvedValue({
|
|
224
|
-
ok: true,
|
|
225
|
-
status: 200,
|
|
226
|
-
text: () => Promise.resolve(''),
|
|
227
|
-
});
|
|
228
|
-
client = new InsigniaClient(BASE);
|
|
229
|
-
const result = await client.get('/path');
|
|
230
|
-
expect(result).toBeNull();
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
test('returns null for no-content responses', async () => {
|
|
234
|
-
global.fetch = jest.fn().mockResolvedValue({
|
|
235
|
-
ok: true,
|
|
236
|
-
status: 204,
|
|
237
|
-
json: jest.fn(),
|
|
238
|
-
});
|
|
239
|
-
client = new InsigniaClient(BASE);
|
|
240
|
-
const result = await client.del('/path');
|
|
241
|
-
expect(result).toBeNull();
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test('returns null when json parsing fails because the response is empty', async () => {
|
|
245
|
-
global.fetch = jest.fn().mockResolvedValue({
|
|
246
|
-
ok: true,
|
|
247
|
-
status: 200,
|
|
248
|
-
json: () => Promise.reject(new SyntaxError('Unexpected end of JSON input')),
|
|
249
|
-
});
|
|
250
|
-
client = new InsigniaClient(BASE);
|
|
251
|
-
const result = await client.get('/path');
|
|
252
|
-
expect(result).toBeNull();
|
|
253
|
-
});
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
// ─── payments(userId).invoiceUrl ──────────────────────────────────────────────
|
|
257
|
-
// A direct link, not a fetch — no HTTP call to mock/assert on, just the URL shape.
|
|
258
|
-
|
|
259
|
-
describe('Users.payments(userId).invoiceUrl', () => {
|
|
260
|
-
test('builds a direct link to the invoice endpoint', () => {
|
|
261
|
-
const client = new InsigniaClient(BASE);
|
|
262
|
-
const users = new Users(client);
|
|
263
|
-
expect(users.payments(42).invoiceUrl(7)).toBe(`${BASE}/users/42/payments/7/invoice`);
|
|
264
|
-
});
|
|
265
|
-
});
|
package/tests/helpers.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import InsigniaApiV1 from '../src/api/v1/index.js';
|
|
2
|
-
|
|
3
|
-
export const api = new InsigniaApiV1(process.env.INSIGNIA_EDUCATION_API_BASE_URL);
|
|
4
|
-
|
|
5
|
-
// captcha_token is required by LoginRequest; relies on the local API's TURNSTILE_SECRET_KEY
|
|
6
|
-
// being set to Cloudflare's documented "always passes" testing secret
|
|
7
|
-
// (1x0000000000000000000000000000000AA), which accepts any token value.
|
|
8
|
-
export const loginCustomer = () => api.auth.login({
|
|
9
|
-
email: process.env.TEST_EMAIL,
|
|
10
|
-
password: process.env.TEST_PASSWORD,
|
|
11
|
-
captcha_token: 'test',
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export const loginAdmin = () => api.auth.login({
|
|
15
|
-
email: process.env.TEST_EMAIL_ADMIN,
|
|
16
|
-
password: process.env.TEST_PASSWORD_ADMIN,
|
|
17
|
-
captcha_token: 'test',
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const logout = () => api.auth.logout();
|