-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.ts
63 lines (56 loc) · 1.03 KB
/
index.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { expect, test } from "bun:test";
import Database from "bun:sqlite";
import { Migration, migrate, withoutComments } from ".";
test("migrate() create table", async () => {
const database = new Database();
const migrations: Migration[] = [
{
id: 0,
name: "create_accounts",
content: `
create table accounts (
username,
display_name,
password
);
`,
},
];
await migrate(database, {
migrations,
log: false,
});
});
// prettier-ignore
test("migrate() using withoutComments()", async () => {
const database = new Database();
const filtered = withoutComments(`
# test comment!!! :D
create table test (
thing, #esd8yr9fy8s90dfy
other_thing # !!!!!!!!11111
#apple
);
# test #
create table ice_cream (
flavor
);
`);
expect(filtered).toBe(`
create table test (
thing,
other_thing
);
create table ice_cream (
flavor
);
`);
await migrate(database, {
migrations: [{
id: 0,
name: "stuff",
content: filtered,
}],
log: false,
});
});