forked from manyuanrong/dso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.ts
37 lines (32 loc) · 732 Bytes
/
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
import { Client } from "./deps.ts";
import { dso } from "./mod.ts";
import "./test/model.ts";
const config = {
hostname: "127.0.0.1",
port: 3306,
poolSize: 3,
debug: false,
username: "root",
password: "",
db: "",
};
const client = new Client();
dso.showQueryLog = false;
export async function clientTest(fn: Function) {
Deno.test({
name: fn.name,
fn: async () => {
await dso.connect({ ...config, db: "test_orm" });
await dso.sync(true);
await fn();
dso.close();
},
});
}
async function main() {
await client.connect(config);
await client.execute(`CREATE DATABASE IF NOT EXISTS test_orm`);
await client.execute(`USE test_orm`);
await client.close();
}
await main();