forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexport.service.spec.ts
More file actions
93 lines (89 loc) · 2.7 KB
/
Copy pathexport.service.spec.ts
File metadata and controls
93 lines (89 loc) · 2.7 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { Test, TestingModule } from "@nestjs/testing";
import { getQueueToken } from "@nestjs/bull";
import { getRepositoryToken } from "@nestjs/typeorm";
import { ExportService } from "./export.service";
import { ConfigService } from "@nestjs/config";
import { ExportJob } from "./entities/export-job.entity";
import { ExportTemplate } from "./entities/export-template.entity";
import { PdfGeneratorService } from "./pdf-generator.service";
import { QuickBooksGeneratorService } from "./quickbooks-generator.service";
import { OfxGeneratorService } from "./ofx-generator.service";
import { EmailService } from "./email.service";
import { StorageService } from "./storage.service";
import { CsvGeneratorService } from "./csv-generator.service";
describe("ExportService", () => {
let service: ExportService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [
ExportService,
{
provide: getQueueToken("export"),
useValue: {
add: jest.fn(),
getJob: jest.fn(),
},
},
{
provide: getRepositoryToken(ExportJob),
useValue: {
find: jest.fn(),
save: jest.fn(),
findOne: jest.fn(),
create: jest.fn(),
findAndCount: jest.fn(),
update: jest.fn(),
count: jest.fn(),
},
},
{
provide: getRepositoryToken(ExportTemplate),
useValue: {
find: jest.fn(),
findOne: jest.fn(),
save: jest.fn(),
create: jest.fn(),
update: jest.fn(),
delete: jest.fn(),
},
},
{ provide: ConfigService, useValue: { get: jest.fn() } },
{
provide: PdfGeneratorService,
useValue: { generatePdf: jest.fn() },
},
{
provide: QuickBooksGeneratorService,
useValue: { generateQbo: jest.fn() },
},
{
provide: OfxGeneratorService,
useValue: { generateOfx: jest.fn() },
},
{
provide: EmailService,
useValue: { sendExportEmail: jest.fn() },
},
{
provide: StorageService,
useValue: {
uploadFile: jest.fn(),
getSignedUrl: jest.fn(),
deleteFile: jest.fn(),
},
},
{
provide: CsvGeneratorService,
useValue: {
generateCsv: jest.fn(),
generateXlsx: jest.fn(),
},
},
],
}).compile();
service = module.get<ExportService>(ExportService);
});
it("should be defined", () => {
expect(service).toBeDefined();
});
});