test(e2e): adapt export specs to 7-column schema (Scénario/Test/...)
Update AC-29.2 (Markdown) to assert | Scénario | GFM table header. Update AC-29.3 (CSV) to assert exact 7 FR column names instead of 'name'. Update AC-31.4 (empty engagement) MD to assert table absent, CSV header to assert exact 7 FR columns. Drop unused sim1/sim2 vars and makeClient import (NIT cleanup). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -16,9 +16,18 @@ import {
|
||||
deleteUserByUsername,
|
||||
ensureUser,
|
||||
login,
|
||||
makeClient,
|
||||
} from '../fixtures/api';
|
||||
|
||||
const CSV_HEADER_COLS = [
|
||||
'Scénario',
|
||||
'Test',
|
||||
'Source de log',
|
||||
'Commentaires SOC',
|
||||
'Exécution',
|
||||
'Logs remontés au SIEM',
|
||||
'Cyber incident',
|
||||
];
|
||||
|
||||
const ADMIN_USER = 'us31-admin';
|
||||
const PASS = 'us31-pass-strong!';
|
||||
|
||||
@@ -142,8 +151,10 @@ test.describe('US-31 — Export robustness', () => {
|
||||
);
|
||||
expect(response.status()).toBe(200);
|
||||
const text = await response.text();
|
||||
// Must contain engagement name in the header section
|
||||
// Engagement header section present
|
||||
expect(text).toContain('US31 empty engagement');
|
||||
// With 0 simulations the GFM table is absent (no rows to render)
|
||||
expect(text).not.toContain('| Scénario |');
|
||||
} finally {
|
||||
await deleteEngagement(adminTok, engagement.id);
|
||||
}
|
||||
@@ -167,8 +178,9 @@ test.describe('US-31 — Export robustness', () => {
|
||||
// Count rows via RFC-4180-aware counter (handles embedded newlines in quoted cells)
|
||||
const rowCount = countCsvRows(text);
|
||||
expect(rowCount).toBe(1);
|
||||
// The single row is the header; must contain 'name' column
|
||||
expect(text.trim()).toContain('name');
|
||||
// The single row is the header with exactly the 7 FR columns
|
||||
const headerCells = text.trim().split(',').map((c) => c.trim().replace(/^"|"$/g, ''));
|
||||
expect(headerCells).toEqual(CSV_HEADER_COLS);
|
||||
} finally {
|
||||
await deleteEngagement(adminTok, engagement.id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user