forked from adamlaska/browser-compat-data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwalkingUtils.test.js
More file actions
36 lines (29 loc) · 1.06 KB
/
walkingUtils.test.js
File metadata and controls
36 lines (29 loc) · 1.06 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
const assert = require('assert').strict;
const bcd = require('..');
const query = require('./query');
const { joinPath, isBrowser, isFeature } = require('./walkingUtils');
describe('joinPath()', function () {
it('joins dotted paths to features', function () {
assert.equal(joinPath('html', 'elements'), 'html.elements');
});
it('silently discards undefineds', function () {
assert.equal(joinPath(undefined, undefined, undefined), '');
assert.equal(joinPath(undefined, 'api'), 'api');
});
});
describe('isBrowser()', function () {
it('returns true for browser-like objects', function () {
assert.ok(isBrowser(bcd.browsers.firefox));
});
it('returns false for feature-like objects', function () {
assert.equal(isBrowser(query('html.elements.a')), false);
});
});
describe('isFeature()', function () {
it('returns false for browser-like objects', function () {
assert.equal(isFeature(bcd.browsers.chrome), false);
});
it('returns true for feature-like objects', function () {
assert.ok(isFeature(query('html.elements.a')));
});
});