deno.land / x / bld@v0.0.1 / helpers.test.ts

helpers.test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { objectToKeyValueArrays, toSQLKeyValuePair, toSQLValueType, valuePlaceholders,} from "./helpers.ts";import { assertEquals } from "https://deno.land/std@0.165.0/testing/asserts.ts";
Deno.test("valuePlaceholders()", () => { let got = valuePlaceholders(["foo", "bar"], 0); let want = "($0, $1)"; assertEquals(got, want);
got = valuePlaceholders(["foo", "bar"], 2); want = "($2, $3)"; assertEquals(got, want);
got = valuePlaceholders(["foo", undefined, "bar"], 2); want = "($2, NULL, $3)"; assertEquals(got, want);});
Deno.test("toSQLValueType", () => { let got = toSQLValueType("foo"); assertEquals(got, "'foo'");
got = toSQLValueType(24); assertEquals(got, "24");
got = toSQLValueType(true); assertEquals(got, "TRUE");
got = toSQLValueType(false); assertEquals(got, "FALSE");});
Deno.test("toSQLValueKeyPair", () => { const got = toSQLKeyValuePair("key", true); assertEquals(got, "key = TRUE");});
Deno.test("objectToKeyValueArrays", () => { const got = objectToKeyValueArrays({ id: 1, foo: "bar" }); assertEquals(got, [["id", "foo"], [1, "bar"]]);});
bld
DocumentationDocumentation
GitHub Repositorywralith/bld
GitHub Stars
0

Version Info

Tagged at
2 months ago

External Dependencies

1 external dependency