@nu-art/testalot 0.401.3 → 0.401.5
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/consts.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/types.js +1 -1
- package/test-template.test.d.ts +0 -1
- package/test-template.test.js +0 -42
package/consts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @nu-art/testalot - Testing utilities and test framework helpers
|
|
3
|
-
* Copyright (C)
|
|
3
|
+
* Copyright (C) 2026 Adam van der Kruk aka TacB0sS
|
|
4
4
|
* Licensed under the Apache License, Version 2.0
|
|
5
5
|
*/
|
|
6
6
|
import chai, { expect } from 'chai';
|
package/index.js
CHANGED
package/package.json
CHANGED
package/types.js
CHANGED
package/test-template.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/test-template.test.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// test input type - will have the parameters that actually makes a test case unique, its content depends on the test performed
|
|
2
|
-
import { runSingleTestCase } from './consts.js';
|
|
3
|
-
const justAGlobalConst = 'just a global const';
|
|
4
|
-
// the test cases, notice these can be a resolvable content, in order to keep bind consts between the input and the output,
|
|
5
|
-
const test = async (input) => {
|
|
6
|
-
// the actual test logic that all test cases will pass through and all will yield the Result
|
|
7
|
-
// this logic is silly but demonstrate the concept
|
|
8
|
-
if (input.inputB === 2)
|
|
9
|
-
throw new Error('a part of the error message would be The expected error message - but it\'s not the only part of the message');
|
|
10
|
-
return iAmJustAHelperFunction();
|
|
11
|
-
};
|
|
12
|
-
// helper function - dedicated for this test suite
|
|
13
|
-
function iAmJustAHelperFunction() {
|
|
14
|
-
return justAGlobalConst;
|
|
15
|
-
}
|
|
16
|
-
const runTestCase = (testCase, processor) => () => runSingleTestCase(test, testCase, processor);
|
|
17
|
-
// the mocha test launch
|
|
18
|
-
describe('template', () => {
|
|
19
|
-
it('My very fancy test', () => {
|
|
20
|
-
const justAConst = 'case 1';
|
|
21
|
-
return runTestCase({
|
|
22
|
-
input: {
|
|
23
|
-
inputA: `input for test ${justAConst}`,
|
|
24
|
-
inputB: 1,
|
|
25
|
-
inputC: ''
|
|
26
|
-
},
|
|
27
|
-
result: justAGlobalConst
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
it('My super fancy test case 2 - expected to fail', () => {
|
|
31
|
-
return runTestCase({
|
|
32
|
-
input: {
|
|
33
|
-
inputA: 'input for test case 2',
|
|
34
|
-
inputB: 2,
|
|
35
|
-
inputC: ''
|
|
36
|
-
},
|
|
37
|
-
error: {
|
|
38
|
-
expected: 'The expected error message'
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|