-
-
Notifications
You must be signed in to change notification settings - Fork 495
/
GH4078.test.ts
54 lines (43 loc) · 970 Bytes
/
GH4078.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
import { Entity, JsonType, PrimaryKey, Property } from '@mikro-orm/core';
import { MikroORM } from '@mikro-orm/mysql';
import { mockLogger } from '../helpers';
type Setup = {
limits?: boolean;
fallbackFees?: boolean;
};
@Entity()
class Contract {
@PrimaryKey()
id!: number;
@Property()
title!: string;
@Property({ type: JsonType, nullable: true })
setup: Setup | null = null;
}
let orm: MikroORM;
beforeAll(async () => {
orm = await MikroORM.init({
entities: [Contract],
dbName: `mikro_orm_test_4078`,
port: 3308,
});
await orm.schema.refreshDatabase();
});
afterAll(async () => {
await orm.close(true);
});
test('4078', async () => {
await orm.em.insert(Contract, {
id: 1,
title: 't',
setup: {
limits: true,
fallbackFees: false,
},
});
orm.em.clear();
await orm.em.findOneOrFail(Contract, 1);
const mock = mockLogger(orm);
await orm.em.flush();
expect(mock).not.toBeCalled();
});