Formatting
All checks were successful
/ Misc Linters (pull_request) Successful in 23s
/ Build App (pull_request) Successful in 1m21s

This commit is contained in:
Valentin Brandl 2024-08-18 15:38:03 +02:00
parent 56f568634e
commit 20920586e0
Signed by: vbrandl
GPG Key ID: CAD4DA1A789125F9
2 changed files with 25 additions and 25 deletions

View File

@ -2,14 +2,14 @@ import { expect, test } from '@playwright/test';
import { validate, NIL } from 'uuid'; import { validate, NIL } from 'uuid';
import { requestIdHeader } from '$lib'; import { requestIdHeader } from '$lib';
test('response contains request-id header', async ({playwright}) => { test('response contains request-id header', async ({ playwright }) => {
const context = await playwright.request.newContext(); const context = await playwright.request.newContext();
const response = await context.get('health'); const response = await context.get('health');
const headers = response.headers(); const headers = response.headers();
await expect(headers).toHaveProperty(requestIdHeader); await expect(headers).toHaveProperty(requestIdHeader);
}); });
test('request-id is valid uuid', async ({playwright}) => { test('request-id is valid uuid', async ({ playwright }) => {
const context = await playwright.request.newContext(); const context = await playwright.request.newContext();
const response = await context.get('health'); const response = await context.get('health');
const headers = response.headers(); const headers = response.headers();
@ -17,20 +17,20 @@ test('request-id is valid uuid', async ({playwright}) => {
await expect(validate(requestId)).toBe(true); await expect(validate(requestId)).toBe(true);
}); });
test('reuse valid incoming uuid', async ({playwright}) => { test('reuse valid incoming uuid', async ({ playwright }) => {
const context = await playwright.request.newContext(); const context = await playwright.request.newContext();
const response = await context.get('health', { headers: { [requestIdHeader]: NIL }}); const response = await context.get('health', { headers: { [requestIdHeader]: NIL } });
const headers = response.headers(); const headers = response.headers();
const requestId = headers[requestIdHeader]; const requestId = headers[requestIdHeader];
await expect(requestId).toBe(NIL); await expect(requestId).toBe(NIL);
}); });
test('ignore invalid incoming uuid', async ({playwright}) => { test('ignore invalid incoming uuid', async ({ playwright }) => {
const invalid = '00000000-0000-0000-0000-00000000000z'; const invalid = '00000000-0000-0000-0000-00000000000z';
const context = await playwright.request.newContext(); const context = await playwright.request.newContext();
const response = await context.get('health', { headers: { [requestIdHeader]: invalid }}); const response = await context.get('health', { headers: { [requestIdHeader]: invalid } });
const headers = response.headers(); const headers = response.headers();
const requestId = headers[requestIdHeader]; const requestId = headers[requestIdHeader];
await expect(requestId).not.toBe(invalid); await expect(requestId).not.toBe(invalid);