Skip to content

Commit a9e6ea3

Browse files
committed
Added unit tests
1 parent 247fbac commit a9e6ea3

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import assert from "assert";
2+
import Sql from "../../../sql/Sql.js";
3+
import QueryCompiler from "../../../compiler/QueryCompiler.js";
4+
5+
export default function () {
6+
7+
const compiler = QueryCompiler.instance;
8+
9+
const name = "Akash";
10+
11+
let r = compiler.execute({ name }, (p) => (x) => x.id ? 1 : -1);
12+
assert.equal("(CASE WHEN x.id THEN 1 ELSE -1 END)", r.text);
13+
14+
r = compiler.execute({ name }, (p) => (x) => x.id ? 1 : -(5*1));
15+
assert.equal("(CASE WHEN x.id THEN 1 ELSE (-5 * 1) END)", r.text);
16+
17+
18+
}
19+
20+
type KeyCode = { name: string, code: number, key: string };

0 commit comments

Comments
 (0)