-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.js
29 lines (23 loc) · 815 Bytes
/
test.js
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
import test from 'ava';
import allKeys from './index.js';
test('main', t => {
t.true(allKeys(Symbol.prototype).has('propertyIsEnumerable'));
t.true(allKeys(Array.prototype).has('push'));
});
test('includeObjectPrototype option', t => {
class Fixture {
foo() {}
}
t.is(allKeys(Fixture.prototype, {includeObjectPrototype: false}).size, 2);
t.false(allKeys(Fixture.prototype, {includeObjectPrototype: false}).has('isPrototypeOf'));
t.true(allKeys(Fixture.prototype).size > 2);
t.true(allKeys(Fixture.prototype).has('isPrototypeOf'));
});
test('includeSymbols option', t => {
const fixtureSymbol = Symbol('fixture');
class Fixture {
[fixtureSymbol]() {}
}
t.false(allKeys(Fixture.prototype, {includeSymbols: false}).has(fixtureSymbol));
t.true(allKeys(Fixture.prototype).has(fixtureSymbol));
});