refactor: items services to Nestjs

This commit is contained in:
Ahmed Bouhuolia
2024-12-15 13:04:41 +02:00
parent 70211980aa
commit 0a112c5655
20 changed files with 897 additions and 18 deletions

View File

@@ -16,4 +16,51 @@ describe('Items (e2e)', () => {
})
.expect(201);
});
it('/items/:id (POST)', async () => {
const item = {
name: faker.commerce.productName(),
type: 'service',
};
return request(app.getHttpServer())
.post('/items')
.set('organization-id', '4064541lv40nhca')
.send({
name: faker.commerce.productName(),
type: 'service',
})
.expect(201);
});
it('/items/:id/inactivate (PATCH)', async () => {
const response = await request(app.getHttpServer())
.post('/items')
.set('organization-id', '4064541lv40nhca')
.send({
name: faker.commerce.productName(),
type: 'service',
});
const itemId = response.body.id;
return request(app.getHttpServer())
.patch(`/items/${itemId}/inactivate`)
.set('organization-id', '4064541lv40nhca')
.expect(200);
});
it('/items/:id/activate (PATCH)', async () => {
const response = await request(app.getHttpServer())
.post('/items')
.set('organization-id', '4064541lv40nhca')
.send({
name: faker.commerce.productName(),
type: 'service',
});
const itemId = response.body.id;
return request(app.getHttpServer())
.patch(`/items/${itemId}/activate`)
.set('organization-id', '4064541lv40nhca')
.expect(200);
});
});