@eduware/oneroster 1.2.5 → 1.2.7
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/FUNCTIONS.md +232 -0
- package/README.md +490 -342
- package/dist/commonjs/clients/classlink.d.ts +2 -3
- package/dist/commonjs/clients/classlink.d.ts.map +1 -1
- package/dist/commonjs/clients/classlink.js.map +1 -1
- package/dist/commonjs/clients/types.d.ts +5 -3
- package/dist/commonjs/clients/types.d.ts.map +1 -1
- package/dist/commonjs/enums/index.d.ts +2 -0
- package/dist/commonjs/enums/index.d.ts.map +1 -0
- package/dist/commonjs/enums/index.js +18 -0
- package/dist/commonjs/enums/index.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +2 -0
- package/dist/commonjs/models/index.d.ts.map +1 -0
- package/dist/commonjs/models/index.js +18 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/types/index.d.ts +1 -0
- package/dist/commonjs/types/index.d.ts.map +1 -1
- package/dist/commonjs/types/index.js +16 -0
- package/dist/commonjs/types/index.js.map +1 -1
- package/dist/esm/clients/classlink.d.ts +2 -3
- package/dist/esm/clients/classlink.d.ts.map +1 -1
- package/dist/esm/clients/classlink.js.map +1 -1
- package/dist/esm/clients/types.d.ts +5 -3
- package/dist/esm/clients/types.d.ts.map +1 -1
- package/dist/esm/enums/index.d.ts +2 -0
- package/dist/esm/enums/index.d.ts.map +1 -0
- package/dist/esm/enums/index.js +2 -0
- package/dist/esm/enums/index.js.map +1 -0
- package/dist/esm/models/index.d.ts +2 -0
- package/dist/esm/models/index.d.ts.map +1 -0
- package/dist/esm/models/index.js +2 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/index.js.map +1 -1
- package/package.json +37 -79
- package/src/clients/classlink.ts +2 -3
- package/src/clients/types.ts +5 -3
- package/src/enums/index.ts +1 -0
- package/src/models/index.ts +1 -0
- package/src/types/index.ts +3 -0
- package/vitest.config.ts +2 -2
- package/test/summary-reporter.ts +0 -114
package/test/summary-reporter.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom Vitest Reporter that prints a summary of passed/failed endpoints
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { Reporter, File, Task } from 'vitest';
|
|
6
|
-
|
|
7
|
-
interface TestResult {
|
|
8
|
-
endpoint: string;
|
|
9
|
-
status: 'passed' | 'failed';
|
|
10
|
-
error?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default class SummaryReporter implements Reporter {
|
|
14
|
-
private results: Map<string, TestResult[]> = new Map();
|
|
15
|
-
|
|
16
|
-
onFinished(files?: File[]) {
|
|
17
|
-
if (!files) return;
|
|
18
|
-
|
|
19
|
-
// Process all test results
|
|
20
|
-
for (const file of files) {
|
|
21
|
-
this.processFile(file);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Print summary
|
|
25
|
-
this.printSummary();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
private processFile(file: File) {
|
|
29
|
-
for (const task of file.tasks) {
|
|
30
|
-
this.processTask(task, null);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private processTask(task: Task, authType: string | null) {
|
|
35
|
-
// Check if this is an auth type suite (e.g., "OAUTH1 API Operations")
|
|
36
|
-
const authMatch = task.name.match(/^(OAUTH1|OAUTH2|BEARER) API Operations$/);
|
|
37
|
-
if (authMatch) {
|
|
38
|
-
authType = authMatch[1]!;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (task.type === 'suite' && 'tasks' in task && task.tasks) {
|
|
42
|
-
for (const child of task.tasks) {
|
|
43
|
-
this.processTask(child, authType);
|
|
44
|
-
}
|
|
45
|
-
} else if (task.type === 'test' && authType) {
|
|
46
|
-
const passed = task.result?.state === 'pass';
|
|
47
|
-
const errorMsg = this.getShortError(task.result?.errors?.[0]?.message);
|
|
48
|
-
this.recordResult(authType, task.name, passed ? 'passed' : 'failed', errorMsg);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
private getShortError(error?: string): string | undefined {
|
|
53
|
-
if (!error) return undefined;
|
|
54
|
-
if (error.includes('404')) return '404 Not Found';
|
|
55
|
-
if (error.includes('401')) return '401 Unauthorized';
|
|
56
|
-
if (error.includes('403')) return '403 Forbidden';
|
|
57
|
-
if (error.includes('ResponseValidationError') || error.includes('Zod'))
|
|
58
|
-
return 'Response validation';
|
|
59
|
-
if (error.length > 40) return error.substring(0, 37) + '...';
|
|
60
|
-
return error;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private recordResult(
|
|
64
|
-
authType: string,
|
|
65
|
-
endpoint: string,
|
|
66
|
-
status: 'passed' | 'failed',
|
|
67
|
-
error?: string
|
|
68
|
-
) {
|
|
69
|
-
if (!this.results.has(authType)) {
|
|
70
|
-
this.results.set(authType, []);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Avoid duplicates
|
|
74
|
-
const existing = this.results.get(authType)!;
|
|
75
|
-
if (!existing.some((r) => r.endpoint === endpoint)) {
|
|
76
|
-
existing.push({ endpoint, status, error });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
private printSummary() {
|
|
81
|
-
console.log('\n');
|
|
82
|
-
console.log('╔══════════════════════════════════════════════════════════════════╗');
|
|
83
|
-
console.log('║ TEST RESULTS SUMMARY ║');
|
|
84
|
-
console.log('╚══════════════════════════════════════════════════════════════════╝');
|
|
85
|
-
|
|
86
|
-
for (const [authType, results] of this.results) {
|
|
87
|
-
const passed = results.filter((r) => r.status === 'passed');
|
|
88
|
-
const failed = results.filter((r) => r.status === 'failed');
|
|
89
|
-
|
|
90
|
-
console.log(`\n┌──────────────────────────────────────────────────────────────────┐`);
|
|
91
|
-
console.log(
|
|
92
|
-
`│ ${authType.padEnd(10)} - ${String(passed.length).padStart(2)} passed, ${String(failed.length).padStart(2)} failed`
|
|
93
|
-
);
|
|
94
|
-
console.log(`└──────────────────────────────────────────────────────────────────┘`);
|
|
95
|
-
|
|
96
|
-
if (passed.length > 0) {
|
|
97
|
-
console.log('\n ✅ PASSED:');
|
|
98
|
-
for (const r of passed) {
|
|
99
|
-
console.log(` • ${r.endpoint}`);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (failed.length > 0) {
|
|
104
|
-
console.log('\n ❌ FAILED:');
|
|
105
|
-
for (const r of failed) {
|
|
106
|
-
const reason = r.error ? ` (${r.error})` : '';
|
|
107
|
-
console.log(` • ${r.endpoint}${reason}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
console.log('\n' + '═'.repeat(70) + '\n');
|
|
113
|
-
}
|
|
114
|
-
}
|