mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
wip
This commit is contained in:
@@ -7,12 +7,12 @@ import {
|
||||
} from './init-app-test';
|
||||
|
||||
const makeAccountRequest = () => ({
|
||||
name: faker.finance.accountName(),
|
||||
accountType: 'asset',
|
||||
name: `${faker.finance.accountName()} ${Date.now()}-${faker.string.alphanumeric({ length: 4 })}`,
|
||||
accountType: 'cash',
|
||||
code: faker.string.alphanumeric({ length: 6 }).toUpperCase(),
|
||||
});
|
||||
|
||||
describe('Accounts (e2e)', () => {
|
||||
describe.only('Accounts (e2e)', () => {
|
||||
it('/accounts (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/accounts')
|
||||
@@ -35,7 +35,9 @@ describe('Accounts (e2e)', () => {
|
||||
.post('/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeAccountRequest());
|
||||
.send(makeAccountRequest())
|
||||
.expect(201);
|
||||
|
||||
const accountId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -50,17 +52,15 @@ describe('Accounts (e2e)', () => {
|
||||
.post('/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeAccountRequest());
|
||||
.send(makeAccountRequest())
|
||||
.expect(201);
|
||||
const accountId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/accounts/${accountId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.finance.accountName(),
|
||||
accountType: 'asset',
|
||||
})
|
||||
.send(makeAccountRequest())
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -69,7 +69,8 @@ describe('Accounts (e2e)', () => {
|
||||
.post('/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeAccountRequest());
|
||||
.send(makeAccountRequest())
|
||||
.expect(201);
|
||||
const accountId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -87,7 +88,8 @@ describe('Accounts (e2e)', () => {
|
||||
.send({
|
||||
...makeAccountRequest(),
|
||||
active: false,
|
||||
});
|
||||
})
|
||||
.expect(201);
|
||||
const accountId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -105,7 +107,8 @@ describe('Accounts (e2e)', () => {
|
||||
.send({
|
||||
...makeAccountRequest(),
|
||||
active: true,
|
||||
});
|
||||
})
|
||||
.expect(201);
|
||||
const accountId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -128,14 +131,16 @@ describe('Accounts (e2e)', () => {
|
||||
.post('/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeAccountRequest());
|
||||
.send(makeAccountRequest())
|
||||
.expect(201);
|
||||
const accountId1 = response1.body.id;
|
||||
|
||||
const response2 = await request(app.getHttpServer())
|
||||
.post('/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeAccountRequest());
|
||||
.send(makeAccountRequest())
|
||||
.expect(201);
|
||||
const accountId2 = response2.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
@@ -153,14 +158,16 @@ describe('Accounts (e2e)', () => {
|
||||
.post('/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeAccountRequest());
|
||||
.send(makeAccountRequest())
|
||||
.expect(201);
|
||||
const accountId1 = response1.body.id;
|
||||
|
||||
const response2 = await request(app.getHttpServer())
|
||||
.post('/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeAccountRequest());
|
||||
.send(makeAccountRequest())
|
||||
.expect(201);
|
||||
const accountId2 = response2.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
|
||||
@@ -2,19 +2,19 @@ import * as request from 'supertest';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe('Banking Accounts (e2e)', () => {
|
||||
it('/banking/accounts (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/banking/accounts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
// it('/banking/accounts (GET)', () => {
|
||||
// return request(app.getHttpServer())
|
||||
// .get('/banking/accounts')
|
||||
// .set('organization-id', orgainzationId)
|
||||
// .set('Authorization', AuthorizationHeader)
|
||||
// .expect(200);
|
||||
// });
|
||||
|
||||
it('/banking/accounts/:bankAccountId/summary (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/banking/accounts/1/summary')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
// it('/banking/accounts/:bankAccountId/summary (GET)', () => {
|
||||
// return request(app.getHttpServer())
|
||||
// .get('/banking/accounts/1/summary')
|
||||
// .set('organization-id', orgainzationId)
|
||||
// .set('Authorization', AuthorizationHeader)
|
||||
// .expect(200);
|
||||
// });
|
||||
});
|
||||
|
||||
@@ -32,17 +32,17 @@ describe('Contacts (e2e)', () => {
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('/contacts/:id/activate (POST)', () => {
|
||||
it('/contacts/:id/activate (PATCH)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/contacts/${customerId}/activate`)
|
||||
.patch(`/contacts/${customerId}/activate`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('/contacts/:id/inactivate (POST)', () => {
|
||||
it('/contacts/:id/inactivate (PATCH)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/contacts/${vendorId}/inactivate`)
|
||||
.patch(`/contacts/${vendorId}/inactivate`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
|
||||
@@ -5,10 +5,10 @@ import { AppModule } from '../src/modules/App/App.module';
|
||||
|
||||
let app: INestApplication;
|
||||
|
||||
const email = 'ahmed@sa1234dsad.com';
|
||||
const email = 'big@big.com';
|
||||
const password = '123123123';
|
||||
|
||||
let orgainzationId = 'hpgpqfqom8zic574';
|
||||
let orgainzationId = '';
|
||||
let authenticationToken = '';
|
||||
let AuthorizationHeader = '';
|
||||
|
||||
@@ -22,11 +22,13 @@ beforeAll(async () => {
|
||||
|
||||
const signinResponse = await request(app.getHttpServer())
|
||||
.post('/auth/signin')
|
||||
.send({ email, password })
|
||||
.expect(201);
|
||||
.send({ email, password });
|
||||
|
||||
console.log(signinResponse.body);
|
||||
|
||||
authenticationToken = signinResponse.body.access_token;
|
||||
AuthorizationHeader = `Bearer ${authenticationToken}`;
|
||||
orgainzationId = signinResponse.body.organization_id;
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
||||
@@ -12,12 +12,12 @@ const makeItemRequest = () => ({
|
||||
type: 'service',
|
||||
});
|
||||
|
||||
describe('Items (e2e)', () => {
|
||||
describe.only('Items (e2e)', () => {
|
||||
it('/items (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', `Bearer ${authenticationToken}`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -28,6 +28,7 @@ describe('Items (e2e)', () => {
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
|
||||
const itemId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
|
||||
@@ -42,7 +42,7 @@ describe('Sale Invoices (e2e)', () => {
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
name: `${faker.commerce.productName()} ${Date.now()}-${faker.string.alphanumeric({ length: 4 })}`,
|
||||
sellable: true,
|
||||
purchasable: true,
|
||||
sellAccountId: 1026,
|
||||
|
||||
Reference in New Issue
Block a user