/
connection.mock.ts
40 lines (38 loc) · 1.1 KB
/
connection.mock.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
import { Type } from '@vendure/common/lib/shared-types';
import { AbstractRepository, EntityManager, Repository } from 'typeorm';
import { MockClass } from './testing-types';
export class MockEntityManager implements MockClass<EntityManager> {
connection: any = {};
queryRunner: any = {};
transaction = jest.fn();
query = jest.fn();
createQueryBuilder = jest.fn();
hasId = jest.fn();
getId = jest.fn();
create = jest.fn();
merge = jest.fn();
preload = jest.fn();
save = jest.fn();
remove = jest.fn();
insert = jest.fn();
update = jest.fn();
delete = jest.fn();
softDelete = jest.fn();
softRemove = jest.fn();
restore = jest.fn();
recover = jest.fn();
count = jest.fn();
find = jest.fn();
findAndCount = jest.fn();
findByIds = jest.fn();
findOne = jest.fn();
findOneOrFail = jest.fn();
clear = jest.fn();
increment = jest.fn();
decrement = jest.fn();
getRepository = jest.fn();
getTreeRepository = jest.fn();
getMongoRepository = jest.fn();
getCustomRepository = jest.fn();
release = jest.fn();
}