1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 17:19:56 +01:00
This commit is contained in:
Janosch 2026-03-27 11:26:06 +01:00
parent e897f41a32
commit 061c2b4f8d
14 changed files with 1293 additions and 18 deletions

View file

@ -0,0 +1,73 @@
import { test, expect } from '../../../fixtures/auth.fixture.js';
/**
* TC-INV Inventurzählungen
* Quelle: GitHub Issues #4#20
*/
test.describe('TC-INV: Inventurzählungen', () => {
async function createStorageLocation(request: Parameters<typeof test>[1]['request'], token: string): Promise<string> {
const res = await request.post('/api/inventory/storage-locations', {
data: { name: `INV-Lager-${Date.now()}`, storageType: 'DRY_STORAGE' },
headers: { Authorization: `Bearer ${token}` },
});
const body = await res.json();
return body.id;
}
test('TC-INV-01: Inventurzählung anlegen', async ({ request, adminToken }) => {
const storageLocationId = await createStorageLocation(request, adminToken);
const res = await request.post('/api/inventory/inventory-counts', {
data: { storageLocationId, countDate: '2026-04-30' },
headers: { Authorization: `Bearer ${adminToken}` },
});
expect(res.status()).toBe(201);
const body = await res.json();
expect(body.status).toBe('PLANNED');
});
test('TC-INV-02: Inventurzählung ohne Lagerort wird abgelehnt', async ({ request, adminToken }) => {
const res = await request.post('/api/inventory/inventory-counts', {
data: { countDate: '2026-04-30' },
headers: { Authorization: `Bearer ${adminToken}` },
});
expect(res.status()).toBe(400);
});
test('TC-INV-03: Inventurzählung starten', async ({ request, adminToken }) => {
const storageLocationId = await createStorageLocation(request, adminToken);
const createRes = await request.post('/api/inventory/inventory-counts', {
data: { storageLocationId, countDate: '2026-05-01' },
headers: { Authorization: `Bearer ${adminToken}` },
});
expect(createRes.status()).toBe(201);
const { id } = await createRes.json();
const startRes = await request.patch(`/api/inventory/inventory-counts/${id}/start`, {
headers: { Authorization: `Bearer ${adminToken}` },
});
expect(startRes.status()).toBe(200);
const body = await startRes.json();
expect(body.status).toBe('IN_PROGRESS');
});
test('TC-INV-04: Inventurzählung stornieren', async ({ request, adminToken }) => {
const storageLocationId = await createStorageLocation(request, adminToken);
const createRes = await request.post('/api/inventory/inventory-counts', {
data: { storageLocationId, countDate: '2026-05-02' },
headers: { Authorization: `Bearer ${adminToken}` },
});
expect(createRes.status()).toBe(201);
const { id } = await createRes.json();
const cancelRes = await request.post(`/api/inventory/inventory-counts/${id}/cancel`, {
data: { reason: 'Test-Stornierung' },
headers: { Authorization: `Bearer ${adminToken}` },
});
expect(cancelRes.status()).toBe(200);
const body = await cancelRes.json();
expect(body.status).toBe('CANCELLED');
});
});