mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
feat(server): more e2e test cases
This commit is contained in:
50
packages/server/test/contacts.e2e-spec.ts
Normal file
50
packages/server/test/contacts.e2e-spec.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
let customerId;
|
||||
let vendorId;
|
||||
|
||||
describe('Contacts (e2e)', () => {
|
||||
beforeAll(async () => {
|
||||
const customer = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({ displayName: 'Test Customer' });
|
||||
|
||||
customerId = customer.body.id;
|
||||
|
||||
const vendor = await request(app.getHttpServer())
|
||||
.post('/vendors')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({ displayName: 'Test Vendor' });
|
||||
|
||||
vendorId = vendor.body.id;
|
||||
});
|
||||
|
||||
it('/contacts/auto-complete (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/contacts/auto-complete')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('/contacts/:id/activate (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/contacts/${customerId}/activate`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('/contacts/:id/inactivate (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/contacts/${vendorId}/inactivate`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user