Reconciliar verificacoes com navegacao e relatorios aprovados
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user