-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathcommon-errors.test.js
More file actions
57 lines (49 loc) · 1.16 KB
/
common-errors.test.js
File metadata and controls
57 lines (49 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* This file is a part of @mdn/browser-compat-data
* See LICENSE file for more information. */
import assert from 'node:assert/strict';
import { fixCommonErrorsInCompatStatement } from './common-errors.js';
/**
* @import { InternalSupportBlock } from '../../types/index.js'
*/
/** @type {{ input: any; output?: Partial<InternalSupportBlock> }[]} */
const tests = [
// Replace unwrapped "false".
{
input: {
firefox_android: false,
},
output: {
firefox_android: { version_added: false },
},
},
// Replace wrapped "mirror".
{
input: {
firefox_android: { version_added: 'mirror' },
},
output: { firefox_android: 'mirror' },
},
// Remove unnecessary IE statement.
{
input: {
ie: { version_added: false },
},
output: {},
},
];
describe('fix -> common errors', () => {
let i = 1;
for (const test of tests) {
it(`Test #${i}`, () => {
const input = {
support: test.input,
};
const output = {
support: test.output ?? test.input,
};
fixCommonErrorsInCompatStatement(input);
assert.deepStrictEqual(input, output);
});
i += 1;
}
});