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