forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplits.e2e.spec.ts
More file actions
49 lines (43 loc) · 1.24 KB
/
Copy pathsplits.e2e.spec.ts
File metadata and controls
49 lines (43 loc) · 1.24 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
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication, ValidationPipe } from '@nestjs/common';
import { AppModule } from '@/app.module';
import request from "supertest";
describe('SplitsController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
app.useGlobalPipes(new ValidationPipe());
await app.init();
});
afterAll(async () => {
await app.close();
});
it('/splits (POST)', () => {
return request(app.getHttpServer())
.post('/splits')
.send({
creatorId: 'wallet_test123',
title: 'Test Dinner',
currency: 'USD',
totalAmount: 150.00,
taxAmount: 12.50,
tipAmount: 22.50,
})
.expect(201)
.expect((res:any) => {
expect(res.body).toHaveProperty('id');
expect(res.body.title).toEqual('Test Dinner');
});
});
it('/splits (GET)', () => {
return request(app.getHttpServer())
.get('/splits')
.expect(200)
.expect((res:any) => {
expect(Array.isArray(res.body)).toBe(true);
});
});
});