Reconciliar verificacoes com navegacao e relatorios aprovados

This commit is contained in:
2026-10-20 15:12:17 +02:00
parent 74b081e93e
commit 6e439def02
5 changed files with 42 additions and 12 deletions
+15
View File
@@ -144,6 +144,21 @@ await test('fetch accepts a real server confirmation', async (t) => {
assert.equal(response.data.reference, 'IR-SERVER-001');
});
await test('browser writes preserve the CSRF cookie header', async (t) => {
const previous = Object.getOwnPropertyDescriptor(globalThis, 'document');
Object.defineProperty(globalThis, 'document', { configurable: true, value: { cookie: 'other=x; XSRF-TOKEN=qa%2Ftoken' } });
try {
t.mock.method(globalThis, 'fetch', async (_url, options) => {
assert.equal(options.headers.get('X-XSRF-TOKEN'), 'qa/token');
return new Response('{"success":true}', { status: 201 });
});
await portalRequest('/api/v1/interest-requests', { method: 'POST' });
} finally {
if (previous) Object.defineProperty(globalThis, 'document', previous);
else delete globalThis.document;
}
});
for (const status of [422, 429, 500]) {
await test(`HTTP ${status} never becomes a successful confirmation`, async (t) => {
t.mock.method(