/
issue-799.ts
37 lines (30 loc) · 993 Bytes
/
issue-799.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 "reflect-metadata";
import * as assert from "assert";
import {createConnection} from "../../../src/index";
import rimraf from "rimraf";
import {dirname} from "path";
import {Connection} from "../../../src/connection/Connection";
describe("github issues > #799 sqlite: 'database' path should be created", () => {
let connection: Connection;
const path = `${__dirname}/tmp/sqlitedb.db`;
const cleanup = (done: () => void) => {
rimraf(dirname(path), () => {
return done();
});
};
before(cleanup);
after(cleanup);
afterEach(() => {
if (connection && connection.isConnected) {
connection.close();
}
});
it("should create the whole path to database file", async function () {
connection = await createConnection({
"name": "sqlite",
"type": "sqlite",
"database": path
});
assert.strictEqual(connection.isConnected, true);
});
});