forked from adamlaska/browser-compat-data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.test.js
More file actions
41 lines (33 loc) · 1.22 KB
/
query.test.js
File metadata and controls
41 lines (33 loc) · 1.22 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
const assert = require('assert').strict;
const query = require('./query');
describe('query()', function () {
describe('should throw on non-existent features', function () {
assert.throws(() => query('nonExistentNameSpace'), ReferenceError);
assert.throws(() => query('api.NonExistentFeature'), ReferenceError);
assert.throws(
() => query('api.NonExistentFeature.subFeature'),
ReferenceError,
);
});
it('should return the expected point in the tree (namespace)', function () {
const obj = query('css');
assert.ok(!('__compat' in obj));
assert.ok('properties' in obj);
assert.ok('at-rules' in obj);
});
it('should return the expected point in the tree (feature)', function () {
const obj = query('api.HTMLAnchorElement.href');
assert.ok('support' in obj.__compat);
assert.ok('status' in obj.__compat);
assert.equal(
'https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/href',
obj.__compat.mdn_url,
);
});
it('should return the expected point in the tree (feature with children)', function () {
const obj = query('api.HTMLAnchorElement');
assert.ok('__compat' in obj);
assert.ok('charset' in obj);
assert.ok('href' in obj);
});
});