mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
refactor: migrate item categories to nestjs
This commit is contained in:
49
packages/server-nest/test/item-categories.e2e-spec.ts
Normal file
49
packages/server-nest/test/item-categories.e2e-spec.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { app } from './init-app-test';
|
||||
|
||||
describe('Item Categories(e2e)', () => {
|
||||
it('/item-categories (POST)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.post('/item-categories')
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.send({
|
||||
name: faker.person.fullName(),
|
||||
description: faker.lorem.sentence(),
|
||||
})
|
||||
.expect(201);
|
||||
});
|
||||
|
||||
it('/item-categories/:id (GET)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/item-categories')
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.send({
|
||||
name: faker.person.fullName(),
|
||||
description: faker.lorem.sentence(),
|
||||
});
|
||||
const itemCategoryId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.get(`/item-categories/${itemCategoryId}`)
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.expect(200);
|
||||
});
|
||||
|
||||
it('/item-categories/:id (DELETE)', async () => {
|
||||
const response = await request(app.getHttpServer())
|
||||
.post('/item-categories')
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.send({
|
||||
name: faker.person.fullName(),
|
||||
description: faker.lorem.sentence(),
|
||||
});
|
||||
|
||||
const itemCategoryId = response.body.id;
|
||||
|
||||
return request(app.getHttpServer())
|
||||
.delete(`/item-categories/${itemCategoryId}`)
|
||||
.set('organization-id', '4064541lv40nhca')
|
||||
.expect(200);
|
||||
});
|
||||
});
|
||||
@@ -1,8 +1,5 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import * as request from 'supertest';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { AppModule } from '../src/modules/App/App.module';
|
||||
import { app } from './init-app-test';
|
||||
|
||||
describe('Items (e2e)', () => {
|
||||
|
||||
Reference in New Issue
Block a user