mirror of https://github.com/TriliumNext/Notes
server-esm: Fix wonderful token type mismatch
parent
20c729e62b
commit
0c87fab550
@ -1,24 +1,26 @@
|
||||
const handleParens = require('../../src/services/search/services/handle_parens');
|
||||
import handleParens from "../../src/services/search/services/handle_parens";
|
||||
import { TokenStructure } from "../../src/services/search/services/types";
|
||||
|
||||
describe("Parens handler", () => {
|
||||
it("handles parens", () => {
|
||||
const input = ["(", "hello", ")", "and", "(", "(", "pick", "one", ")", "and", "another", ")"]
|
||||
.map(token => ({token}));
|
||||
|
||||
expect(handleParens(input))
|
||||
.toEqual([
|
||||
const actual: TokenStructure = [
|
||||
[
|
||||
{token: "hello"}
|
||||
],
|
||||
{token: "and"},
|
||||
[
|
||||
[
|
||||
{token: "hello"}
|
||||
{token: "pick"},
|
||||
{token: "one"}
|
||||
],
|
||||
{token: "and"},
|
||||
[
|
||||
[
|
||||
{token: "pick"},
|
||||
{token: "one"}
|
||||
],
|
||||
{token: "and"},
|
||||
{token: "another"}
|
||||
]
|
||||
]);
|
||||
{token: "another"}
|
||||
]
|
||||
];
|
||||
|
||||
expect(handleParens(input)).toEqual(actual);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue