Skip to content

Commit

Permalink
Add complex function test
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubknejzlik committed Mar 7, 2024
1 parent 2e3be03 commit 06eb47b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Function.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,10 @@ describe("Expression", () => {
"(YEAR(`a`) - YEAR(`b`))"
);
});

it("complex functions", () => {
expect(Fn.if(Cond.lessThan("a", 30), "a", "b").toSQL(flavor)).toEqual(
"IF(`a` < 30,`a`,`b`)"
);
});
});
1 change: 0 additions & 1 deletion src/Function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
OperationExpression,
} from "./Expression";
import { Q } from "./Query";
import { MySQLFlavor } from "./flavors/mysql";

const formatDayjs = (dayjs: Dayjs) => dayjs.format("YYYY-MM-DD");

Expand Down

0 comments on commit 06eb47b

Please sign in to comment.