forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathast.spec.js
More file actions
42 lines (35 loc) · 1.14 KB
/
ast.spec.js
File metadata and controls
42 lines (35 loc) · 1.14 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
import { findBestMatchExpression } from "../ast";
import getSymbols from "../../workers/parser/getSymbols";
import { getSource } from "../../workers/parser/tests/helpers";
describe("find the best expression for the token", () => {
it("should find the identifier", () => {
const source = getSource("computed-props");
const symbols = getSymbols(source);
const expression = findBestMatchExpression(
symbols,
{ line: 1, column: 13 },
"key"
);
expect(expression).toMatchSnapshot();
});
it("should find the expression for the property", () => {
const source = getSource("computed-props");
const symbols = getSymbols(source);
const expression = findBestMatchExpression(
symbols,
{ line: 6, column: 16 },
"b"
);
expect(expression).toMatchSnapshot();
});
it("should find the identifier for computed member expressions", () => {
const source = getSource("computed-props");
const symbols = getSymbols(source);
const expression = findBestMatchExpression(
symbols,
{ line: 5, column: 6 },
"key"
);
expect(expression).toMatchSnapshot();
});
});