Skip to content

Commit

Permalink
chore: Move useWebSocket to app-development (#13912)
Browse files Browse the repository at this point in the history
  • Loading branch information
wrt95 authored Oct 30, 2024
1 parent 7c0e49b commit 7c1ce6d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { ReactNode } from 'react';
import React from 'react';
import { screen, waitFor } from '@testing-library/react';
import { textMock } from '@studio/testing/mocks/i18nMock';
import { useWebSocket } from 'app-shared/hooks/useWebSocket';
import { useWebSocket } from 'app-development/hooks/useWebSocket';
import { SyncEventsWebSocketHub } from 'app-shared/api/paths';
import { WSConnector } from 'app-shared/websockets/WSConnector';
import type { SyncError, SyncSuccess } from 'app-shared/types/api/SyncResponses';
Expand All @@ -13,7 +13,7 @@ import { WebSocketSyncWrapper } from './WebSocketSyncWrapper';
import { renderWithProviders } from '../../test/testUtils';
import { APP_DEVELOPMENT_BASENAME } from 'app-shared/constants';

jest.mock('app-shared/hooks/useWebSocket', () => ({
jest.mock('app-development/hooks/useWebSocket', () => ({
useWebSocket: jest.fn(),
}));

Expand Down Expand Up @@ -48,7 +48,7 @@ describe('WebSocketSyncWrapper', () => {
.mockImplementation((callback: Function) => callback(syncErrorMock));

(useWebSocket as jest.Mock).mockReturnValue({
...jest.requireActual('app-shared/hooks/useWebSocket'),
...jest.requireActual('app-development/hooks/useWebSocket'),
onWSMessageReceived: mockOnWSMessageReceived,
});

Expand All @@ -74,7 +74,7 @@ describe('WebSocketSyncWrapper', () => {
.mockImplementation((callback: Function) => callback(syncSuccessMock));

(useWebSocket as jest.Mock).mockReturnValue({
...jest.requireActual('app-shared/hooks/useWebSocket'),
...jest.requireActual('app-development/hooks/useWebSocket'),
onWSMessageReceived: mockOnWSMessageReceived,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactElement } from 'react';
import React, { useEffect } from 'react';
import { useWebSocket } from 'app-shared/hooks/useWebSocket';
import { useWebSocket } from 'app-development/hooks/useWebSocket';
import { WSConnector } from 'app-shared/websockets/WSConnector';
import { toast } from 'react-toastify';
import { SyncSuccessQueriesInvalidator } from 'app-shared/queryInvalidator/SyncSuccessQueriesInvalidator';
Expand Down
1 change: 1 addition & 0 deletions frontend/app-development/hooks/useWebSocket/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useWebSocket } from './useWebSocket';
4 changes: 2 additions & 2 deletions frontend/app-development/layout/PageLayout.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import type { ServicesContextProps } from 'app-shared/contexts/ServicesContext';
import { RoutePaths } from 'app-development/enums/RoutePaths';
import { repoStatus } from 'app-shared/mocks/mocks';
import { HeaderMenuItemKey } from 'app-development/enums/HeaderMenuItemKey';
import { useWebSocket } from 'app-shared/hooks/useWebSocket';
import { useWebSocket } from 'app-development/hooks/useWebSocket';
import { SyncEventsWebSocketHub } from 'app-shared/api/paths';
import { WSConnector } from 'app-shared/websockets/WSConnector';

jest.mock('app-shared/hooks/useWebSocket', () => ({
jest.mock('app-development/hooks/useWebSocket', () => ({
useWebSocket: jest.fn(),
}));

Expand Down

0 comments on commit 7c1ce6d

Please sign in to comment.