Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix: broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Raspincel committed Mar 7, 2024
1 parent 3f9b99d commit 63df372
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/components/base/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { EVENT_BUS_MOCK } from '../../../__mocks__/event-bus.mock';
import { MOCK_OBSERVER_HELPER } from '../../../__mocks__/observer-helper.mock';
import { MOCK_GROUP, MOCK_LOCAL_PARTICIPANT } from '../../../__mocks__/participants.mock';
import { ABLY_REALTIME_MOCK } from '../../../__mocks__/realtime.mock';
import { Group } from '../../common/types/participant.types';
import { Logger } from '../../common/utils';
import { useStore } from '../../common/utils/use-store';
import { Configuration } from '../../services/config/types';
import { EventBus } from '../../services/event-bus';
import { AblyRealtimeService } from '../../services/realtime';
Expand Down Expand Up @@ -66,6 +66,7 @@ describe('BaseComponent', () => {
realtime: ABLY_REALTIME_MOCK,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

DummyComponentInstance['start'] = jest.fn(DummyComponentInstance['start']);
Expand All @@ -88,6 +89,7 @@ describe('BaseComponent', () => {
realtime: ablyMock as AblyRealtimeService,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

DummyComponentInstance['start'] = jest.fn();
Expand All @@ -105,6 +107,7 @@ describe('BaseComponent', () => {
realtime: REALTIME_MOCK,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

expect(DummyComponentInstance['realtime']).toEqual(REALTIME_MOCK);
Expand All @@ -120,6 +123,7 @@ describe('BaseComponent', () => {
realtime: null as unknown as AblyRealtimeService,
config: null as unknown as Configuration,
eventBus: null as unknown as EventBus,
useStore: null as unknown as typeof useStore,
});
}).toThrowError();
});
Expand All @@ -134,6 +138,7 @@ describe('BaseComponent', () => {
realtime: REALTIME_MOCK,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

DummyComponentInstance.detach();
Expand All @@ -153,6 +158,7 @@ describe('BaseComponent', () => {
realtime: REALTIME_MOCK,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

DummyComponentInstance.subscribe('test', callback);
Expand Down
6 changes: 4 additions & 2 deletions src/components/comments/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { TestScheduler } from 'rxjs/testing';

import { MOCK_ANNOTATION } from '../../../__mocks__/comments.mock';
import { MOCK_CONFIG } from '../../../__mocks__/config.mock';
import { EVENT_BUS_MOCK } from '../../../__mocks__/event-bus.mock';
Expand All @@ -9,6 +7,7 @@ import { ABLY_REALTIME_MOCK } from '../../../__mocks__/realtime.mock';
import { CommentEvent } from '../../common/types/events.types';
import { ParticipantByGroupApi } from '../../common/types/participant.types';
import sleep from '../../common/utils/sleep';
import { useStore } from '../../common/utils/use-store';
import ApiService from '../../services/api';
import { useGlobalStore } from '../../services/stores';
import { CommentsFloatButton } from '../../web-components';
Expand Down Expand Up @@ -81,6 +80,7 @@ describe('Comments', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: true }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

commentsComponent['element'].updateAnnotations = jest.fn();
Expand Down Expand Up @@ -333,6 +333,7 @@ describe('Comments', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: true }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

await sleep(1);
Expand All @@ -350,6 +351,7 @@ describe('Comments', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: true }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

await sleep(1);
Expand Down
4 changes: 3 additions & 1 deletion src/components/presence-mouse/canvas/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { MOCK_CANVAS } from '../../../../__mocks__/canvas.mock';
import { MOCK_CONFIG } from '../../../../__mocks__/config.mock';
import { EVENT_BUS_MOCK } from '../../../../__mocks__/event-bus.mock';
import { MOCK_GROUP, MOCK_LOCAL_PARTICIPANT } from '../../../../__mocks__/participants.mock';
import { MOCK_LOCAL_PARTICIPANT } from '../../../../__mocks__/participants.mock';
import { ABLY_REALTIME_MOCK } from '../../../../__mocks__/realtime.mock';
import { useStore } from '../../../common/utils/use-store';
import { ParticipantMouse } from '../types';

import { PointersCanvas } from './index';
Expand Down Expand Up @@ -35,6 +36,7 @@ const createMousePointers = (): PointersCanvas => {
realtime: ABLY_REALTIME_MOCK,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

presenceMouseComponent['canvas'] = {
Expand Down
4 changes: 3 additions & 1 deletion src/components/presence-mouse/html/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { MOCK_CONFIG } from '../../../../__mocks__/config.mock';
import { EVENT_BUS_MOCK } from '../../../../__mocks__/event-bus.mock';
import { MOCK_GROUP, MOCK_LOCAL_PARTICIPANT } from '../../../../__mocks__/participants.mock';
import { MOCK_LOCAL_PARTICIPANT } from '../../../../__mocks__/participants.mock';
import { ABLY_REALTIME_MOCK } from '../../../../__mocks__/realtime.mock';
import { INDEX_IS_WHITE_TEXT } from '../../../common/types/meeting-colors.types';
import { useStore } from '../../../common/utils/use-store';
import { ParticipantMouse, Element } from '../types';

import { PointersHTML } from '.';
Expand All @@ -15,6 +16,7 @@ const createMousePointers = (): PointersHTML => {
realtime: ABLY_REALTIME_MOCK,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

return presenceMouseComponent;
Expand Down
6 changes: 5 additions & 1 deletion src/components/realtime/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MOCK_CONFIG } from '../../../__mocks__/config.mock';
import { EVENT_BUS_MOCK } from '../../../__mocks__/event-bus.mock';
import { MOCK_GROUP, MOCK_LOCAL_PARTICIPANT } from '../../../__mocks__/participants.mock';
import { ABLY_REALTIME_MOCK } from '../../../__mocks__/realtime.mock';
import { useStore } from '../../common/utils/use-store';

import { Realtime } from '.';

Expand Down Expand Up @@ -31,6 +31,7 @@ describe('realtime component', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: true }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});
});

Expand Down Expand Up @@ -76,6 +77,7 @@ describe('realtime component', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: false }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

RealtimeComponentInstance.subscribe('test', callback);
Expand All @@ -94,6 +96,7 @@ describe('realtime component', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: false }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

RealtimeComponentInstance.subscribe('test', callback);
Expand All @@ -118,6 +121,7 @@ describe('realtime component', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: false }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

RealtimeComponentInstance.publish('test', 'test');
Expand Down
3 changes: 3 additions & 0 deletions src/components/video/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '../../common/types/events.types';
import { MeetingColors } from '../../common/types/meeting-colors.types';
import { ParticipantType } from '../../common/types/participant.types';
import { useStore } from '../../common/utils/use-store';
import { AblyParticipant, AblyRealtimeData } from '../../services/realtime/ably/types';
import { VideoFrameState } from '../../services/video-conference-manager/types';
import { ComponentNames } from '../types';
Expand Down Expand Up @@ -97,6 +98,7 @@ describe('VideoConference', () => {
realtime: MOCK_REALTIME,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});
});

Expand All @@ -120,6 +122,7 @@ describe('VideoConference', () => {
realtime: MOCK_REALTIME,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

expect(VideoConferenceInstance['videoConfig'].canUseDefaultAvatars).toBeFalsy();
Expand Down
4 changes: 2 additions & 2 deletions src/components/who-is-online/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { EVENT_BUS_MOCK } from '../../../__mocks__/event-bus.mock';
import {
MOCK_ABLY_PARTICIPANT,
MOCK_ABLY_PARTICIPANT_DATA_2,
MOCK_GROUP,
MOCK_LOCAL_PARTICIPANT,
MOCK_ABLY_PARTICIPANT_DATA_1,
} from '../../../__mocks__/participants.mock';
import { ABLY_REALTIME_MOCK } from '../../../__mocks__/realtime.mock';
import { RealtimeEvent, WhoIsOnlineEvent } from '../../common/types/events.types';
import { MeetingColorsHex } from '../../common/types/meeting-colors.types';
import { useGlobalStore } from '../../services/stores';
import { useStore } from '../../common/utils/use-store';

import { WhoIsOnline } from './index';

Expand All @@ -25,6 +24,7 @@ describe('Who Is Online', () => {
realtime: Object.assign({}, ABLY_REALTIME_MOCK, { isJoinedRoom: true }),
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

whoIsOnlineComponent['localParticipantId'] = MOCK_LOCAL_PARTICIPANT.id;
Expand Down
2 changes: 2 additions & 0 deletions src/core/launcher/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EVENT_BUS_MOCK } from '../../../__mocks__/event-bus.mock';
import { MOCK_GROUP, MOCK_LOCAL_PARTICIPANT } from '../../../__mocks__/participants.mock';
import { ABLY_REALTIME_MOCK } from '../../../__mocks__/realtime.mock';
import { ParticipantEvent, RealtimeEvent } from '../../common/types/events.types';
import { useStore } from '../../common/utils/use-store';
import { BaseComponent } from '../../components/base';
import { ComponentNames } from '../../components/types';
import LimitsService from '../../services/limits';
Expand Down Expand Up @@ -96,6 +97,7 @@ describe('Launcher', () => {
realtime: ABLY_REALTIME_MOCK,
config: MOCK_CONFIG,
eventBus: EVENT_BUS_MOCK,
useStore,
});

expect(ABLY_REALTIME_MOCK.updateMyProperties).toHaveBeenCalledWith({
Expand Down

0 comments on commit 63df372

Please sign in to comment.