Skip to content

Commit

Permalink
Adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hudson-newey committed Nov 12, 2024
1 parent 5ac0fa1 commit 8fc0a96
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ describe("AnnotationSearchComponent", () => {
mockAnnotationResponse = new Annotation(
generateAnnotation({
audioRecording: mockAudioRecording,
}),
injector
})
);

audioEventsApiSpy = spectator.inject(SHALLOW_AUDIO_EVENT.token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ describe("VerificationComponent", () => {
injector
);

mockAnnotationResponse = new Annotation(
generateAnnotation({ audioRecording: mockAudioRecording }),
injector
);
mockAnnotationResponse = new Annotation(generateAnnotation({ audioRecording: mockAudioRecording }));

spectator.component.searchParameters = mockSearchParameters;
spectator.component.project = routeProject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe("AudioEventCardComponent", () => {
endTimeSeconds: 5,
tags: [mockTag],
}),
injectorSpy
);

audioRecordingApiSpy = spectator.inject(AUDIO_RECORDING.token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ describe("GridTileContentComponent", () => {
audioRecording: mockAudioRecording,
audioRecordingId: mockAudioRecording.id,
}),
injectorSpy
);

updateContext(mockAnnotation);
Expand Down Expand Up @@ -111,7 +110,7 @@ describe("GridTileContentComponent", () => {
});

it("should have the correct audio link if a new subject is provided", () => {
const newTestSubject = new Annotation(generateAnnotation(), injectorSpy);
const newTestSubject = new Annotation(generateAnnotation());
updateContext(newTestSubject);

const expectedHref = newTestSubject.viewUrl;
Expand Down
13 changes: 2 additions & 11 deletions src/app/models/data/Annotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,15 @@ import { MediaService } from "@services/media/media.service";
export interface IAnnotation extends Required<IAudioEvent> {
tags: ITag[];
audioRecording: AudioRecording;

viewUrl: string;
listenViewUrl: string;
audioLink: string;
}

type AnnotationConstructor = Omit<IAnnotation, "viewUrl" | "listenViewUrl">;

// this class is not backed by the api or a database table
// I have created this model so that we can pass around a single model that
// contains all the information we need about an annotation
//
// this model is created from the AnnotationService and MediaService's
export class Annotation
extends AbstractData<AnnotationConstructor>
implements IAnnotation
{
public constructor(data: AnnotationConstructor) {
export class Annotation extends AbstractData implements IAnnotation {
public constructor(data: any) {
super(data);

this.viewUrl = annotationMenuItem.route.format({
Expand Down

0 comments on commit 8fc0a96

Please sign in to comment.