@jrpool/kilotest 46.0.0 → 46.0.1
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/api/util.test.js +42 -0
- package/package.json +26 -2
package/api/util.test.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
util.test.js
|
|
3
|
+
Tests for api/util.js.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// IMPORTS
|
|
7
|
+
|
|
8
|
+
const {test} = require('node:test');
|
|
9
|
+
const assert = require('node:assert/strict');
|
|
10
|
+
const {getRuleEngineFacts, getRuleEnginesFacts} = require('./util');
|
|
11
|
+
|
|
12
|
+
// TESTS
|
|
13
|
+
|
|
14
|
+
test('getRuleEngineFacts returns the name and sponsor of a known rule engine', () => {
|
|
15
|
+
const facts = getRuleEngineFacts('axe');
|
|
16
|
+
assert.deepEqual(facts, {
|
|
17
|
+
identifier: 'axe',
|
|
18
|
+
name: 'Axe',
|
|
19
|
+
sponsor: 'Deque'
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('getRuleEngineFacts returns nulls for name and sponsor of an unknown rule engine', () => {
|
|
24
|
+
const facts = getRuleEngineFacts('nonexistentEngine');
|
|
25
|
+
assert.deepEqual(facts, {
|
|
26
|
+
identifier: 'nonexistentEngine',
|
|
27
|
+
name: null,
|
|
28
|
+
sponsor: null
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('getRuleEnginesFacts returns facts sorted alphabetically by name', () => {
|
|
33
|
+
// Names: ibm -> "Accessibility Checker", axe -> "Axe", wave -> "WAVE".
|
|
34
|
+
const facts = getRuleEnginesFacts(new Set(['wave', 'axe', 'ibm']));
|
|
35
|
+
assert.deepEqual(facts.map(fact => fact.identifier), ['ibm', 'axe', 'wave']);
|
|
36
|
+
assert.deepEqual(facts.map(fact => fact.name), ['Accessibility Checker', 'Axe', 'WAVE']);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('getRuleEnginesFacts returns an empty array for an empty set', () => {
|
|
40
|
+
const facts = getRuleEnginesFacts(new Set());
|
|
41
|
+
assert.deepEqual(facts, []);
|
|
42
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jrpool/kilotest",
|
|
3
|
-
"version": "46.0.
|
|
3
|
+
"version": "46.0.1",
|
|
4
4
|
"description": "Ensemble testing for front-end web quality",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "node index",
|
|
11
11
|
"lint": "npx eslint && npx markdownlint-cli2",
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "c8 node --test",
|
|
13
13
|
"test:api": "node api/testSuite",
|
|
14
14
|
"generate:openapi": "node scripts/generate-openapi"
|
|
15
15
|
},
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@eslint/json": "*",
|
|
45
45
|
"@eslint/markdown": "*",
|
|
46
46
|
"@redocly/cli": "*",
|
|
47
|
+
"c8": "*",
|
|
47
48
|
"eslint": "*",
|
|
48
49
|
"globals": "*",
|
|
49
50
|
"js-yaml": "*",
|
|
@@ -52,5 +53,28 @@
|
|
|
52
53
|
},
|
|
53
54
|
"allowScripts": {
|
|
54
55
|
"fsevents@2.3.2": true
|
|
56
|
+
},
|
|
57
|
+
"c8": {
|
|
58
|
+
"all": true,
|
|
59
|
+
"reporter": [
|
|
60
|
+
"text",
|
|
61
|
+
"html"
|
|
62
|
+
],
|
|
63
|
+
"include": [
|
|
64
|
+
"index.js",
|
|
65
|
+
"mcp.js",
|
|
66
|
+
"alerts.js",
|
|
67
|
+
"util.js",
|
|
68
|
+
"api/**/*.js"
|
|
69
|
+
],
|
|
70
|
+
"exclude": [
|
|
71
|
+
"coverage/**",
|
|
72
|
+
"test{,s}/**",
|
|
73
|
+
"test{,-*}.{js,cjs,mjs}",
|
|
74
|
+
"**/*{.,-}test.{js,cjs,mjs}",
|
|
75
|
+
"**/__tests__/**",
|
|
76
|
+
"web/**",
|
|
77
|
+
"scripts/**"
|
|
78
|
+
]
|
|
55
79
|
}
|
|
56
80
|
}
|