mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-25 20:40:36 +03:00
This commit is contained in:
parent
23e2b2f0ba
commit
10905fa5a5
15
rsconcept/frontend/tests/mocks/library.ts
Normal file
15
rsconcept/frontend/tests/mocks/library.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { type Page } from '@playwright/test';
|
||||
|
||||
import { type ILibraryItem } from '../../src/features/library/backend/types';
|
||||
import { BACKEND_URL } from './constants';
|
||||
|
||||
export const dataLibraryItems: ILibraryItem[] = [];
|
||||
|
||||
export async function setupLibrary(page: Page) {
|
||||
await page.route(`${BACKEND_URL}/api/library/all`, async route => {
|
||||
await route.fulfill({ json: dataLibraryItems });
|
||||
});
|
||||
await page.route(`${BACKEND_URL}/api/library/active`, async route => {
|
||||
await route.fulfill({ json: dataLibraryItems });
|
||||
});
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import { test as base } from '@playwright/test';
|
||||
|
||||
import { setupAuth } from './mocks/auth';
|
||||
import { setupLibrary } from './mocks/library';
|
||||
import { setupUsers } from './mocks/users';
|
||||
export { expect } from '@playwright/test';
|
||||
|
||||
|
@ -8,6 +9,7 @@ export const test = base.extend({
|
|||
page: async ({ page }, use) => {
|
||||
await setupAuth(page);
|
||||
await setupUsers(page);
|
||||
await setupLibrary(page);
|
||||
|
||||
await use(page);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user