(test) adapt tests with updated dependencies

- update e2e tests to match changed function signatures
- remove unused pdf-parse type definitions
- fix type error in hocuspocusWS tests
This commit is contained in:
Anthony LC
2025-11-06 12:43:34 +01:00
parent 78a6307656
commit ad16c0843c
8 changed files with 124 additions and 197 deletions

View File

@@ -7,8 +7,8 @@ import {
import { v1 as uuidv1, v4 as uuidv4 } from 'uuid';
import {
afterAll,
afterEach,
beforeAll,
beforeEach,
describe,
expect,
test,
@@ -45,7 +45,8 @@ import { hocuspocusServer, initApp } from '@/servers';
describe('Server Tests', () => {
let server: Server;
beforeEach(() => {
afterEach(() => {
vi.clearAllMocks();
vi.restoreAllMocks();
});
@@ -203,11 +204,12 @@ describe('Server Tests', () => {
test('WebSocket connection fails if user can not access document', () => {
const { promise, done } = promiseDone();
const room = uuidv4();
const fetchDocumentMock = vi
.spyOn(CollaborationBackend, 'fetchDocument')
.mockRejectedValue(new Error('some error'));
const room = uuidv4();
const wsHocus = new HocuspocusProviderWebsocket({
url: `ws://localhost:${portWS}/?room=${room}`,
WebSocketPolyfill: WebSocket,