Skip to content

Commit

Permalink
typechecl
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Sep 4, 2024
1 parent 6bbf632 commit a787215
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/test/CreateRecording/SnapshotRecordingForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { SnapshotRecordingForm } from '@app/CreateRecording/SnapshotRecordingForm';
import { authFailMessage } from '@app/ErrorView/types';
import { ActiveRecording, RecordingState } from '@app/Shared/Services/api.types';
import { ServiceContext, Services, defaultServices } from '@app/Shared/Services/Services';
import { TargetService } from '@app/Shared/Services/Target.service';
import { screen, cleanup, act as doAct } from '@testing-library/react';
Expand All @@ -31,6 +32,23 @@ const mockTarget = {
labels: [],
annotations: { cryostat: [], platform: [] },
};
const mockRecording: ActiveRecording = {
id: 100,
state: RecordingState.RUNNING,
duration: 1010,
startTime: 9999,
continuous: false,
toDisk: false,
maxSize: 55,
maxAge: 66,
remoteId: 77,
name: 'snapshot-10',
downloadUrl: 'http://localhost:8080/api/v4/targets/1/recordings/77',
reportUrl: 'http://localhost:8080/api/v4/targets/1/reports/77',
metadata: {
labels: [],
},
};

jest.spyOn(defaultServices.target, 'authFailure').mockReturnValue(of());
jest.spyOn(defaultServices.target, 'target').mockReturnValue(of(mockTarget));
Expand Down Expand Up @@ -67,7 +85,7 @@ describe('<SnapshotRecordingForm />', () => {
});

it('should create Recording when create is clicked', async () => {
const onCreateSpy = jest.spyOn(defaultServices.api, 'createSnapshot').mockReturnValue(of(true));
const onCreateSpy = jest.spyOn(defaultServices.api, 'createSnapshot').mockReturnValue(of(mockRecording));
const { user } = render({
routerConfigs: {
routes: [
Expand Down
1 change: 1 addition & 0 deletions src/test/RecordingMetadata/BulkEditLabels.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const mockActiveRecording: ActiveRecording = {
toDisk: false,
maxSize: 0,
maxAge: 0,
remoteId: 9876,
};

const mockActiveLabelsNotification = {
Expand Down
1 change: 1 addition & 0 deletions src/test/Recordings/Filters/DurationFilter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const mockRecording: ActiveRecording = {
toDisk: false,
maxSize: 0,
maxAge: 0,
remoteId: 8765,
};

const onDurationInput = jest.fn((_durationInput) => undefined);
Expand Down
1 change: 1 addition & 0 deletions src/test/Recordings/Filters/LabelFilter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const mockRecording: ActiveRecording = {
toDisk: false,
maxSize: 0,
maxAge: 0,
remoteId: 6543,
};
const mockAnotherRecording = {
...mockRecording,
Expand Down
1 change: 1 addition & 0 deletions src/test/Recordings/Filters/NameFilter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const mockRecording: ActiveRecording = {
toDisk: false,
maxSize: 0,
maxAge: 0,
remoteId: 5432,
};
const mockAnotherRecording = { ...mockRecording, name: 'anotherRecording' };
const mockRecordingList = [mockRecording, mockAnotherRecording];
Expand Down
1 change: 1 addition & 0 deletions src/test/Recordings/Filters/RecordingStateFilter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const mockRecording: ActiveRecording = {
toDisk: false,
maxSize: 0,
maxAge: 0,
remoteId: 4321,
};
const mockAnotherRecording = {
...mockRecording,
Expand Down
1 change: 1 addition & 0 deletions src/test/Recordings/RecordingFilters.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const mockActiveRecording: ActiveRecording = {
toDisk: false,
maxSize: 0,
maxAge: 0,
remoteId: 3210,
};
const mockActiveRecordingList = [
mockActiveRecording,
Expand Down

0 comments on commit a787215

Please sign in to comment.