forked from MyZubster-Ecosystem/myzubster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.test.js
More file actions
33 lines (28 loc) 路 1.42 KB
/
Copy pathserver.test.js
File metadata and controls
33 lines (28 loc) 路 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const request = require('supertest');
const app = require('./backend/src/index');
describe('Synthetic Pilot API', () => {
test('health endpoint identifies synthetic environment', async () => {
const res = await request(app).get('/health');
expect(res.status).toBe(200);
});
test('operator can advance an intervention', async () => {
const res = await request(app).post('/interventions/INT-003/advance').send({ actor: 'test-operator', role: 'operator' });
expect(res.status).toBe(200);
});
test('operator cannot close an intervention', async () => {
const res = await request(app).post('/interventions/INT-003/advance').send({ actor: 'test-operator', role: 'operator' });
expect(res.status).toBe(200);
const second = await request(app).post('/interventions/INT-003/advance').send({ actor: 'test-operator', role: 'operator' });
expect(second.status).toBe(200);
const third = await request(app).post('/interventions/INT-003/advance').send({ actor: 'test-operator', role: 'operator' });
expect(third.status).toBe(403);
});
test('reviewer can close a verification item', async () => {
const res = await request(app).post('/interventions/INT-003/verify').send({ actor: 'test-reviewer', role: 'reviewer' });
expect(res.status).toBe(200);
});
test('audit chain verifies', async () => {
const res = await request(app).get('/audit/INT-003');
expect(res.status).toBe(200);
});
});