trilium/spec/search/parens.spec.js

25 lines
724 B
JavaScript
Raw Normal View History

2020-07-21 06:01:07 +08:00
const handleParens = require('../../src/services/search/services/handle_parens.js');
2020-05-19 06:00:35 +08:00
describe("Parens handler", () => {
2020-05-20 06:03:33 +08:00
it("handles parens", () => {
2020-07-20 05:19:45 +08:00
const input = ["(", "hello", ")", "and", "(", "(", "pick", "one", ")", "and", "another", ")"]
.map(token => ({token}));
2020-07-21 06:01:07 +08:00
expect(handleParens(input))
2020-05-19 06:00:35 +08:00
.toEqual([
[
2020-07-20 05:19:45 +08:00
{token: "hello"}
2020-05-19 06:00:35 +08:00
],
2020-07-20 05:19:45 +08:00
{token: "and"},
2020-05-19 06:00:35 +08:00
[
[
2020-07-20 05:19:45 +08:00
{token: "pick"},
{token: "one"}
2020-05-19 06:00:35 +08:00
],
2020-07-20 05:19:45 +08:00
{token: "and"},
{token: "another"}
2020-05-19 06:00:35 +08:00
]
]);
});
});