mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
refactor(nestjs): e2e test cases
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { TenantBaseModel } from '@/modules/System/models/TenantBaseModel';
|
||||
|
||||
export class DocumentModel extends TenantBaseModel{
|
||||
export class DocumentModel extends TenantBaseModel {
|
||||
originName!: string;
|
||||
size!: number;
|
||||
mimeType!: string;
|
||||
key!: string;
|
||||
size!: number;
|
||||
mimeType!: string;
|
||||
key!: string;
|
||||
|
||||
/**
|
||||
* Table name
|
||||
|
||||
@@ -22,7 +22,7 @@ export class DocumentLinkModel extends TenantBaseModel {
|
||||
* Relationship mapping.
|
||||
*/
|
||||
static get relationMappings() {
|
||||
const { DocumentModel } = require('./Document');
|
||||
const { DocumentModel } = require('./Document.model');
|
||||
|
||||
return {
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as request from 'supertest';
|
||||
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app } from './init-app-test';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
const requestBankRule = () => ({
|
||||
name: faker.company.name(),
|
||||
@@ -25,6 +25,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/banking/rules')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestBankRule())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -33,6 +34,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/banking/rules')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestBankRule());
|
||||
|
||||
const ruleId = response.body.id;
|
||||
@@ -40,6 +42,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/banking/rules/${ruleId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestBankRule())
|
||||
.expect(200);
|
||||
});
|
||||
@@ -48,6 +51,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/banking/rules')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestBankRule());
|
||||
|
||||
const ruleId = response.body.id;
|
||||
@@ -55,6 +59,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/banking/rules/${ruleId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -62,6 +67,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/banking/rules')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestBankRule());
|
||||
|
||||
const ruleId = response.body.id;
|
||||
@@ -69,6 +75,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/banking/rules/${ruleId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -76,6 +83,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/banking/rules')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestBankRule());
|
||||
|
||||
const ruleId = response.body.id;
|
||||
@@ -83,6 +91,7 @@ describe('Bank Rules (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/banking/rules/${ruleId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
const createOwnerContributionTransaction = () => ({
|
||||
date: '2024-01-01',
|
||||
@@ -23,6 +23,7 @@ describe('Banking Transactions (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/banking/transactions')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(createOwnerContributionTransaction())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -32,6 +33,7 @@ describe('Banking Transactions (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/banking/transactions')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(transaction)
|
||||
.expect(201);
|
||||
|
||||
@@ -40,6 +42,7 @@ describe('Banking Transactions (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/banking/transactions/${transactionId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -48,6 +51,7 @@ describe('Banking Transactions (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/banking/transactions')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(transaction)
|
||||
.expect(201);
|
||||
|
||||
@@ -56,6 +60,7 @@ describe('Banking Transactions (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/banking/transactions/${transactionId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe('Branches (e2e)', () => {
|
||||
it('/branches (POST)', () => {
|
||||
@@ -27,6 +27,7 @@ describe('Branches (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/branches/${branchId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -34,6 +35,7 @@ describe('Branches (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/branches')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
code: faker.string.alpha(4),
|
||||
@@ -43,6 +45,7 @@ describe('Branches (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/branches/${branchId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -50,6 +53,7 @@ describe('Branches (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/branches')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
code: faker.string.alpha(4),
|
||||
@@ -59,6 +63,7 @@ describe('Branches (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/branches/${branchId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -66,6 +71,7 @@ describe('Branches (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/branches')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as request from 'supertest';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
let customerId;
|
||||
@@ -28,6 +28,7 @@ describe('Credit Notes (e2e)', () => {
|
||||
const customer = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({ displayName: 'Test Customer' });
|
||||
|
||||
customerId = customer.body.id;
|
||||
@@ -35,6 +36,7 @@ describe('Credit Notes (e2e)', () => {
|
||||
const item = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
sellable: true,
|
||||
@@ -51,6 +53,7 @@ describe('Credit Notes (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/credit-notes')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestCreditNote())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -59,12 +62,14 @@ describe('Credit Notes (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/credit-notes')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestCreditNote());
|
||||
const creditNoteId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/credit-notes/${creditNoteId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -73,12 +78,14 @@ describe('Credit Notes (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/credit-notes')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(creditNote);
|
||||
const creditNoteId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/credit-notes/${creditNoteId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(creditNote)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -87,12 +94,14 @@ describe('Credit Notes (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/credit-notes')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestCreditNote());
|
||||
const creditNoteId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/credit-notes/${creditNoteId}/open`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe('Customers (e2e)', () => {
|
||||
it('/customers (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
customerType: 'business',
|
||||
displayName: faker.commerce.productName(),
|
||||
@@ -21,6 +22,7 @@ describe('Customers (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
customerType: 'business',
|
||||
displayName: faker.commerce.productName(),
|
||||
@@ -33,6 +35,7 @@ describe('Customers (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/customers/${customerId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -40,6 +43,7 @@ describe('Customers (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
customerType: 'business',
|
||||
displayName: faker.commerce.productName(),
|
||||
@@ -52,6 +56,7 @@ describe('Customers (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/customers/${customerId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -59,6 +64,7 @@ describe('Customers (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
customerType: 'business',
|
||||
displayName: faker.commerce.productName(),
|
||||
@@ -71,6 +77,7 @@ describe('Customers (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/customers/${customerId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
displayName: faker.commerce.productName(),
|
||||
email: faker.internet.email(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
const makeExpenseRequest = () => ({
|
||||
exchangeRate: 1,
|
||||
@@ -24,6 +24,7 @@ describe('Expenses (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeExpenseRequest())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -32,6 +33,7 @@ describe('Expenses (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeExpenseRequest());
|
||||
|
||||
const expenseId = response.body.id;
|
||||
@@ -39,6 +41,7 @@ describe('Expenses (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/expenses/${expenseId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeExpenseRequest())
|
||||
.expect(200);
|
||||
});
|
||||
@@ -47,6 +50,7 @@ describe('Expenses (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeExpenseRequest());
|
||||
|
||||
const expenseId = response.body.id;
|
||||
@@ -54,6 +58,7 @@ describe('Expenses (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/expenses/${expenseId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -61,6 +66,7 @@ describe('Expenses (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/expenses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeExpenseRequest());
|
||||
|
||||
const expenseId = response.body.id;
|
||||
@@ -68,6 +74,7 @@ describe('Expenses (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/expenses/${expenseId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
import * as request from 'supertest';
|
||||
import { INestApplication, Logger } from '@nestjs/common';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { AppModule } from '../src/modules/App/App.module';
|
||||
|
||||
let app: INestApplication;
|
||||
|
||||
let orgainzationId = 'hpgpqhanm8s4921m';
|
||||
let authenticationToken =
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzQ4MzExOTc5LjIzOCwiaWF0IjoxNzQzMTI3OTc5fQ.h3xvmuNjeyFeshEZRVRLCsARgTpx4xeZQHQuZzESm2U';
|
||||
const email = 'ahmed@sa1234dsad.com';
|
||||
const password = '123123123';
|
||||
|
||||
let orgainzationId = 'hpgpqfqom8zic574';
|
||||
let authenticationToken = '';
|
||||
let AuthorizationHeader = '';
|
||||
|
||||
beforeAll(async () => {
|
||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||
@@ -21,6 +25,16 @@ afterAll(async () => {
|
||||
await app.close();
|
||||
});
|
||||
|
||||
jest.retryTimes(3, { logErrorsBeforeRetry: true });
|
||||
// jest.retryTimes(3, { logErrorsBeforeRetry: true });
|
||||
|
||||
export { app, orgainzationId, authenticationToken };
|
||||
beforeAll(async () => {
|
||||
const signinResponse = await request(app.getHttpServer())
|
||||
.post('/auth/signin')
|
||||
.send({ email, password })
|
||||
.expect(201);
|
||||
|
||||
authenticationToken = signinResponse.body.access_token;
|
||||
AuthorizationHeader = `Bearer ${authenticationToken}`;
|
||||
})
|
||||
|
||||
export { app, orgainzationId, authenticationToken, AuthorizationHeader };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
export const createInventoryAdjustment = ({ itemId }) => ({
|
||||
date: '2020-01-01',
|
||||
@@ -29,6 +29,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
const itemResponse = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest())
|
||||
.expect(201);
|
||||
|
||||
@@ -37,6 +38,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/inventory-adjustments/quick')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(createInventoryAdjustment({ itemId }))
|
||||
.expect(201);
|
||||
});
|
||||
@@ -45,6 +47,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
const itemResponse = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest())
|
||||
.expect(201);
|
||||
|
||||
@@ -52,6 +55,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
|
||||
const inventoryAdjustmentResponse = await request(app.getHttpServer())
|
||||
.post('/inventory-adjustments/quick')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(createInventoryAdjustment({ itemId }))
|
||||
.expect(201);
|
||||
@@ -61,6 +65,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/inventory-adjustments/${inventoryAdjustmentId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -68,6 +73,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
const itemResponse = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest())
|
||||
.expect(201);
|
||||
|
||||
@@ -75,6 +81,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
const inventoryAdjustmentResponse = await request(app.getHttpServer())
|
||||
.post('/inventory-adjustments/quick')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(createInventoryAdjustment({ itemId }))
|
||||
.expect(201);
|
||||
|
||||
@@ -83,6 +90,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/inventory-adjustments/${inventoryAdjustmentId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -90,6 +98,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
const itemResponse = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest())
|
||||
.expect(201);
|
||||
|
||||
@@ -97,6 +106,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
const inventoryAdjustmentResponse = await request(app.getHttpServer())
|
||||
.post('/inventory-adjustments/quick')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
...createInventoryAdjustment({ itemId }),
|
||||
publish: false,
|
||||
@@ -108,6 +118,7 @@ describe('Inventory Adjustments (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/inventory-adjustments/${inventoryAdjustmentId}/publish`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe('Item Categories(e2e)', () => {
|
||||
it('/item-categories (POST)', () => {
|
||||
@@ -18,6 +18,7 @@ describe('Item Categories(e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/item-categories')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.person.fullName(),
|
||||
description: faker.lorem.sentence(),
|
||||
@@ -27,6 +28,7 @@ describe('Item Categories(e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/item-categories/${itemCategoryId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -34,6 +36,7 @@ describe('Item Categories(e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/item-categories')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.person.fullName(),
|
||||
description: faker.lorem.sentence(),
|
||||
@@ -44,6 +47,7 @@ describe('Item Categories(e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/item-categories/${itemCategoryId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import {
|
||||
app,
|
||||
authenticationToken,
|
||||
AuthorizationHeader,
|
||||
orgainzationId,
|
||||
} from './init-app-test';
|
||||
|
||||
const makeItemRequest = () => ({
|
||||
name: faker.commerce.productName(),
|
||||
@@ -12,6 +17,7 @@ describe('Items (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', `Bearer ${authenticationToken}`)
|
||||
.send(makeItemRequest())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -20,12 +26,14 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
const itemId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/items/${itemId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
});
|
||||
|
||||
@@ -33,12 +41,14 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
const itemId = response.text;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.patch(`/items/${itemId}/inactivate`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -46,12 +56,14 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
const itemId = response.text;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.patch(`/items/${itemId}/activate`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -59,12 +71,14 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
const itemId = response.text;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/items/${itemId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -72,6 +86,7 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
|
||||
const itemId = response.text;
|
||||
@@ -79,6 +94,7 @@ describe('Items (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/items/${itemId}/invoices`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -86,6 +102,7 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
|
||||
const itemId = response.text;
|
||||
@@ -93,6 +110,7 @@ describe('Items (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/items/${itemId}/bills`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -100,6 +118,7 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
|
||||
const itemId = response.text;
|
||||
@@ -107,6 +126,7 @@ describe('Items (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/items/${itemId}/estimates`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -114,6 +134,7 @@ describe('Items (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeItemRequest());
|
||||
|
||||
const itemId = response.text;
|
||||
@@ -121,6 +142,7 @@ describe('Items (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/items/${itemId}/receipts`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
const makeManualJournalRequest = () => ({
|
||||
date: '2022-06-01',
|
||||
@@ -28,6 +28,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/manual-journals')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeManualJournalRequest())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -36,6 +37,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/manual-journals')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeManualJournalRequest());
|
||||
|
||||
const journalId = response.body.id;
|
||||
@@ -43,6 +45,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/manual-journals/${journalId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send()
|
||||
.expect(200);
|
||||
});
|
||||
@@ -51,6 +54,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/manual-journals')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeManualJournalRequest());
|
||||
|
||||
const journalId = response.body.id;
|
||||
@@ -58,6 +62,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/manual-journals/${journalId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send()
|
||||
.expect(200);
|
||||
});
|
||||
@@ -67,6 +72,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/manual-journals')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(manualJournal);
|
||||
|
||||
const journalId = response.body.id;
|
||||
@@ -74,6 +80,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/manual-journals/${journalId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(manualJournal)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -82,6 +89,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/manual-journals')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeManualJournalRequest());
|
||||
|
||||
const journalId = response.body.id;
|
||||
@@ -89,6 +97,7 @@ describe.only('Manual Journals (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/manual-journals/${journalId}/publish`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send()
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
let invoice;
|
||||
let customerId;
|
||||
@@ -52,6 +52,7 @@ describe('Payment Received (e2e)', () => {
|
||||
const item = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
sellable: true,
|
||||
@@ -68,6 +69,7 @@ describe('Payment Received (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
invoice = response.body;
|
||||
@@ -77,6 +79,7 @@ describe('Payment Received (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/payments-received')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestPaymentReceivedBody(invoice.id))
|
||||
.expect(201);
|
||||
});
|
||||
@@ -85,6 +88,7 @@ describe('Payment Received (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/payments-received')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestPaymentReceivedBody(invoice.id));
|
||||
|
||||
const paymentReceivedId = response.body.id;
|
||||
@@ -99,6 +103,7 @@ describe('Payment Received (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/payments-received')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestPaymentReceivedBody(invoice.id));
|
||||
|
||||
const paymentReceivedId = response.body.id;
|
||||
@@ -106,6 +111,7 @@ describe('Payment Received (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/payments-received/${paymentReceivedId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -113,6 +119,7 @@ describe('Payment Received (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/payments-received')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestPaymentReceivedBody(invoice.id));
|
||||
|
||||
const paymentReceivedId = response.body.id;
|
||||
@@ -120,6 +127,7 @@ describe('Payment Received (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/payments-received/${paymentReceivedId}/invoices`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -127,6 +135,7 @@ describe('Payment Received (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/payments-received/state')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -134,6 +143,7 @@ describe('Payment Received (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/payments-received')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestPaymentReceivedBody(invoice.id));
|
||||
|
||||
const paymentReceivedId = response.body.id;
|
||||
@@ -141,6 +151,7 @@ describe('Payment Received (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/payments-received/${paymentReceivedId}/mail`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
subject: 'Email subject from here',
|
||||
to: 'a.bouhuolia@gmail.com',
|
||||
@@ -153,6 +164,7 @@ describe('Payment Received (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/payments-received')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestPaymentReceivedBody(invoice.id));
|
||||
|
||||
const paymentReceivedId = response.body.id;
|
||||
@@ -160,6 +172,7 @@ describe('Payment Received (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/payments-received/${paymentReceivedId}/mail`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe('Pdf Templates (e2e)', () => {
|
||||
it('/pdf-templates (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/pdf-templates')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
template_name: 'Standard',
|
||||
resource: 'SaleInvoice',
|
||||
@@ -18,6 +18,7 @@ describe('Pdf Templates (e2e)', () => {
|
||||
it('/pdf-templates (DELETE)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/pdf-templates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send({
|
||||
template_name: 'Standard',
|
||||
@@ -29,12 +30,14 @@ describe('Pdf Templates (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/pdf-templates/${pdfTemplateId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('/pdf-templates/:id (GET)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/pdf-templates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send({
|
||||
template_name: 'Standard',
|
||||
@@ -45,6 +48,7 @@ describe('Pdf Templates (e2e)', () => {
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/pdf-templates/${pdfTemplateId}`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -52,6 +56,7 @@ describe('Pdf Templates (e2e)', () => {
|
||||
it('/pdf-templates/:id/assign-default (POST)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/pdf-templates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send({
|
||||
template_name: 'Standard',
|
||||
@@ -62,6 +67,7 @@ describe('Pdf Templates (e2e)', () => {
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/pdf-templates/${pdfTemplateId}/assign-default`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
let customerId;
|
||||
let itemId;
|
||||
@@ -29,6 +29,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
beforeAll(async () => {
|
||||
const customer = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send({ displayName: 'Test Customer' });
|
||||
|
||||
@@ -53,6 +54,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates (POST)', async () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeEstimateRequest())
|
||||
.expect(201);
|
||||
@@ -61,6 +63,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates (DELETE)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeEstimateRequest());
|
||||
|
||||
@@ -68,6 +71,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/sale-estimates/${estimateId}`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -75,6 +79,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates/state (GET)', async () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/sale-estimates/state')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -82,6 +87,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates/:id (GET)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeEstimateRequest());
|
||||
|
||||
@@ -89,6 +95,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-estimates/${estimateId}`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -96,6 +103,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates/:id/approve (PUT)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send({ ...makeEstimateRequest(), delivered: true });
|
||||
|
||||
@@ -103,6 +111,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/sale-estimates/${estimateId}/approve`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -110,6 +119,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates/:id/reject (PUT)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send({ ...makeEstimateRequest(), delivered: true });
|
||||
|
||||
@@ -117,6 +127,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/sale-estimates/${estimateId}/reject`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -124,6 +135,7 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates (GET)', async () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -131,11 +143,13 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates/:id/mail (GET)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeEstimateRequest());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-estimates/${response.body.id}/mail`)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.expect(200);
|
||||
});
|
||||
@@ -143,12 +157,14 @@ describe('Sale Estimates (e2e)', () => {
|
||||
it('/sale-estimates/:id/mail (POST)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-estimates')
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.set('organization-id', orgainzationId)
|
||||
.send(makeEstimateRequest());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.post(`/sale-estimates/${response.body.id}/mail`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
subject: 'Email subject from here',
|
||||
to: 'a.bouhuolia@gmail.com',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
let customerId;
|
||||
let itemId;
|
||||
@@ -32,6 +32,7 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const customer = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({ displayName: 'Test Customer' });
|
||||
|
||||
customerId = customer.body.id;
|
||||
@@ -39,6 +40,7 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const item = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
sellable: true,
|
||||
@@ -55,6 +57,7 @@ describe('Sale Invoices (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -63,11 +66,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/sale-invoices/${response.body.id}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -75,11 +80,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/sale-invoices/${response.body.id}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody())
|
||||
.expect(200);
|
||||
});
|
||||
@@ -88,11 +95,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -100,11 +109,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-invoices/${response.body.id}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -112,11 +123,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-invoices/${response.body.id}/state`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -124,11 +137,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-invoices/${response.body.id}/payments`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -136,11 +151,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.post(`/sale-invoices/${response.body.id}/writeoff`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
expenseAccountId: 1024,
|
||||
date: '2023-01-01',
|
||||
@@ -153,11 +170,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
await request(app.getHttpServer())
|
||||
.post(`/sale-invoices/${response.body.id}/writeoff`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
expenseAccountId: 1024,
|
||||
date: '2023-01-01',
|
||||
@@ -167,6 +186,7 @@ describe('Sale Invoices (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/sale-invoices/${response.body.id}/cancel-writeoff`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -174,6 +194,7 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
...requestSaleInvoiceBody(),
|
||||
delivered: false,
|
||||
@@ -182,6 +203,7 @@ describe('Sale Invoices (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post(`/sale-invoices/${response.body.id}/deliver`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -189,11 +211,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-invoices/${response.body.id}/mail-state`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -201,11 +225,13 @@ describe('Sale Invoices (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-invoices')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestSaleInvoiceBody());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.put(`/sale-invoices/${response.body.id}/mail`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
subject: 'Email subject from here',
|
||||
to: 'a.bouhuolia@gmail.com',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
let customerId;
|
||||
let itemId;
|
||||
@@ -31,6 +31,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
const customer = await request(app.getHttpServer())
|
||||
.post('/customers')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({ displayName: 'Test Customer' });
|
||||
|
||||
customerId = customer.body.id;
|
||||
@@ -38,6 +39,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
const item = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
sellable: true,
|
||||
@@ -54,6 +56,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/sale-receipts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeReceiptRequest())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -62,6 +65,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-receipts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeReceiptRequest());
|
||||
|
||||
const receiptId = response.body.id;
|
||||
@@ -76,6 +80,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-receipts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeReceiptRequest());
|
||||
|
||||
const receiptId = response.body.id;
|
||||
@@ -83,6 +88,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/sale-receipts/${receiptId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
...makeReceiptRequest(),
|
||||
referenceNo: '321',
|
||||
@@ -94,6 +100,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/sale-receipts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -101,6 +108,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-receipts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeReceiptRequest());
|
||||
|
||||
const receiptId = response.body.id;
|
||||
@@ -108,6 +116,7 @@ describe('Sale Receipts (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-receipts/${receiptId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -115,11 +124,13 @@ describe('Sale Receipts (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/sale-receipts')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeReceiptRequest());
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/sale-receipts/${response.body.id}/mail`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as request from 'supertest';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
const makeSettingsRequest = () => ({
|
||||
options: [
|
||||
@@ -21,6 +21,7 @@ describe('Settings (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put('/settings')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(makeSettingsRequest())
|
||||
.expect(200);
|
||||
});
|
||||
@@ -29,6 +30,7 @@ describe('Settings (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/settings')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe('Item Categories(e2e)', () => {
|
||||
it('/tax-rates (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/tax-rates')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.person.fullName(),
|
||||
rate: 2,
|
||||
@@ -20,6 +21,7 @@ describe('Item Categories(e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/tax-rates')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.person.fullName(),
|
||||
rate: 2,
|
||||
@@ -31,6 +33,7 @@ describe('Item Categories(e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/tax-rates/${taxRateId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as request from 'supertest';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe.only('Transactions Locking (e2e)', () => {
|
||||
it('/transactions-locking/lock (PUT)', () => {
|
||||
@@ -18,6 +18,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
await request(app.getHttpServer())
|
||||
.put('/transactions-locking/lock')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
module: 'all',
|
||||
lock_to_date: '2025-01-01',
|
||||
@@ -28,6 +29,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put('/transactions-locking/cancel-lock')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -35,6 +37,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
await request(app.getHttpServer())
|
||||
.put('/transactions-locking/lock')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
module: 'all',
|
||||
lock_to_date: '2025-01-01',
|
||||
@@ -45,6 +48,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put('/transactions-locking/cancel-lock')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
module: 'all',
|
||||
unlockFromDate: '2025-01-01',
|
||||
@@ -58,6 +62,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
await request(app.getHttpServer())
|
||||
.put('/transactions-locking/lock')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
module: 'all',
|
||||
lock_to_date: '2025-01-01',
|
||||
@@ -68,6 +73,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
await request(app.getHttpServer())
|
||||
.put('/transactions-locking/unlock-partial')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
module: 'all',
|
||||
unlockFromDate: '2025-01-01',
|
||||
@@ -79,6 +85,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put('/transactions-locking/cancel-unlock-partial')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
module: 'all',
|
||||
unlockFromDate: '2025-01-01',
|
||||
@@ -92,6 +99,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/transactions-locking')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -99,6 +107,7 @@ describe.only('Transactions Locking (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/transactions-locking/all')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
let vendorId;
|
||||
let itemId;
|
||||
@@ -28,6 +28,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
const vendor = await request(app.getHttpServer())
|
||||
.post('/vendors')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({ displayName: 'Test Customer' });
|
||||
|
||||
vendorId = vendor.body.id;
|
||||
@@ -35,6 +36,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
const item = await request(app.getHttpServer())
|
||||
.post('/items')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
sellable: true,
|
||||
@@ -51,6 +53,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/vendor-credits')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestVendorCredit())
|
||||
.expect(201);
|
||||
});
|
||||
@@ -59,6 +62,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/vendor-credits')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestVendorCredit());
|
||||
|
||||
const vendorCreditId = response.body.id;
|
||||
@@ -66,6 +70,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/vendor-credits/${vendorCreditId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -73,6 +78,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/vendor-credits')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestVendorCredit());
|
||||
|
||||
const vendorCreditId = response.body.id;
|
||||
@@ -80,6 +86,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/vendor-credits/${vendorCreditId}/open`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -87,6 +94,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/vendor-credits')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send(requestVendorCredit());
|
||||
|
||||
const vendorCreditId = response.body.id;
|
||||
@@ -94,6 +102,7 @@ describe('Vendor Credits (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/vendor-credits/${vendorCreditId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe.only('Vendors (e2e)', () => {
|
||||
it('/vendors (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/vendors')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
displayName: faker.commerce.productName(),
|
||||
email: faker.internet.email(),
|
||||
@@ -20,6 +21,7 @@ describe.only('Vendors (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/vendors')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
displayName: faker.commerce.productName(),
|
||||
email: faker.internet.email(),
|
||||
@@ -31,6 +33,7 @@ describe.only('Vendors (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.put(`/vendors/${vendorId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
displayName: faker.commerce.productName(),
|
||||
email: faker.internet.email(),
|
||||
@@ -44,6 +47,7 @@ describe.only('Vendors (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/vendors')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
displayName: faker.commerce.productName(),
|
||||
email: faker.internet.email(),
|
||||
@@ -62,6 +66,7 @@ describe.only('Vendors (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/vendors')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
displayName: faker.commerce.productName(),
|
||||
});
|
||||
@@ -70,6 +75,7 @@ describe.only('Vendors (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/vendors/${vendorId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app, orgainzationId } from './init-app-test';
|
||||
import { app, AuthorizationHeader, orgainzationId } from './init-app-test';
|
||||
|
||||
describe('Warehouses (e2e)', () => {
|
||||
it('/warehouses (POST)', () => {
|
||||
@@ -18,6 +18,7 @@ describe('Warehouses (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/warehouses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
code: faker.string.alpha(4),
|
||||
@@ -34,6 +35,7 @@ describe('Warehouses (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/warehouses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
code: faker.string.alpha(4),
|
||||
@@ -50,6 +52,7 @@ describe('Warehouses (e2e)', () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/warehouses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.send({
|
||||
name: faker.commerce.productName(),
|
||||
code: faker.string.alpha(4),
|
||||
@@ -59,6 +62,7 @@ describe('Warehouses (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get(`/warehouses/${warehouseId}`)
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
@@ -66,6 +70,7 @@ describe('Warehouses (e2e)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/warehouses')
|
||||
.set('organization-id', orgainzationId)
|
||||
.set('Authorization', AuthorizationHeader)
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user