Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions tests/api/auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { test, expect } from '@playwright/test';
import { test } from './fixtures/base';
import { expect } from '@playwright/test';
import { randomUUID } from 'node:crypto';
// TO DO: investigate how run test with auth and without it

test.fixme('should return success response if the Autorization header is right', async () => {
// const response = await fetchListOfReports(env.API_TOKEN as string);
// expect(response.status).toBe(200);
// expect(await response.text()).not.toBe('Unauthorized');
});
// test ('should return success response if the Autorization header is right', async ({request}) => {
// const token = process.env.API_TOKEN;
// const response = await request.get('/api/result/list', {
// headers: {
// Authorization: `${token}`,
// },
// });
// expect(response.status()).toBe(200);
// expect(await response.text()).not.toBe('Unauthorized');
// });

test.fixme('should return unauthorised if the Autorization header is wrong', async () => {
// const response = await fetchListOfReports(randomUUID());
// expect(response.status).toBe(401);
// expect(await response.text()).toBe('Unauthorized');
});
// test ('should return unauthorised if the Autorization header is wrong', async ({request}) => {
// const response = await request.get('/api/report/list', {
// headers: {
// Authorization: `Bearer ${randomUUID()}`,
// },
// });
// expect(response.status()).toBe(401);
// expect(await response.text()).toBe('Unauthorized');
// });