-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathcommon-errors.test.js
More file actions
53 lines (45 loc) · 1.08 KB
/
common-errors.test.js
File metadata and controls
53 lines (45 loc) · 1.08 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
/* This file is a part of @mdn/browser-compat-data
* See LICENSE file for more information. */
import assert from 'node:assert/strict';
import { fixCommonErrorsInSupportBlock } from './common-errors.js';
/**
* @import { InternalSupportBlock } from '../../types/index.js'
*/
/** @type {{ input: any; output: 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 = test.input;
const output = test.output ?? test.input;
fixCommonErrorsInSupportBlock(input);
assert.deepStrictEqual(input, output);
});
i += 1;
}
});