tests/database.test.ts   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 20
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2
mnd 2
bc 2
fnc 0
bpm 0
cpm 0
noi 0
1
import {Database, Store} from "../src/Jeloquent";
2
3
import {User, UserAddress, Avatar, Team, Comment} from "./Models";
4
5
test('tables can be added or dropped', () => {
6
    const store = new Store();
7
    const database = new Database('defaultDb', [Team, User, UserAddress, Avatar, Comment]);
8
    store.add(database);
9
    store.use('defaultDb');
10
11
    for (const tableName of store.database().showTables()) {
12
        expect(['Team', 'User', 'UserAddress', 'Avatar', 'Comment']).toContain(tableName);
13
    }
14
15
16
    database.drop('User');
17
    for (const tableName of store.database().showTables()) {
18
        expect(['Team', 'UserAddress', 'Avatar', 'Comment']).toContain(tableName);
19
    }
20
});