-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
visitor-keys.ts
28 lines (23 loc) · 1008 Bytes
/
visitor-keys.ts
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
import { AST_NODE_TYPES } from '../../src/ts-estree';
import { visitorKeys } from '../../src/visitor-keys';
//------------------------------------------------------------------------------
// Setup
//------------------------------------------------------------------------------
const astTypes = Object.keys(AST_NODE_TYPES);
astTypes.push(AST_NODE_TYPES.TSEmptyBodyFunctionExpression); // node created by parser.ts
//------------------------------------------------------------------------------
// Tests
//------------------------------------------------------------------------------
describe('visitor-keys', () => {
for (const type of astTypes) {
it(`type ${type} should be present in visitor-keys`, () => {
expect(visitorKeys).toHaveProperty(type);
});
}
it('check if there is no deprecated TS nodes', () => {
const TSTypes = Object.keys(visitorKeys).filter(type =>
type.startsWith('TS'),
);
expect(astTypes).toEqual(expect.arrayContaining(TSTypes));
});
});