Skip to content

Commit

Permalink
test(Archive): Fix archive run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreykwan committed Aug 11, 2023
1 parent e6f23c9 commit cec8b19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/app/teacher/run-menu/run-menu.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function archive() {
describe('archive()', () => {
it('should archive a run', () => {
component.archive();
expect(component.run.project.isDeleted).toEqual(true);
expect(component.run.isArchived).toEqual(true);
expect(snackBarSpy).toHaveBeenCalledWith('Successfully Archived Run');
});
});
Expand All @@ -122,7 +122,7 @@ function unarchive() {
describe('unarchive()', () => {
it('should unarchive a run', () => {
component.unarchive();
expect(component.run.project.isDeleted).toEqual(false);
expect(component.run.isArchived).toEqual(false);
expect(snackBarSpy).toHaveBeenCalledWith('Successfully Unarchived Run');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ let teacherService: TeacherService;
function createRun(id: number, ownerId: number): TeacherRun {
return new TeacherRun({
id: id,
project: { id: id, isDeleted: false },
owner: new User({ id: ownerId })
project: { id: id, tags: [] },
owner: new User({ id: ownerId }),
isArchived: false
});
}

Expand Down Expand Up @@ -181,7 +182,7 @@ function setRunsIsSelected(runs: TeacherRun[], isSelected: boolean[]): void {

function expectRunsIsArchived(runs: TeacherRun[], isArchived: boolean[]): void {
runs.forEach((run: TeacherRun, index: number) => {
expect(run.project.isDeleted).toEqual(isArchived[index]);
expect(run.isArchived).toEqual(isArchived[index]);
});
}

Expand Down Expand Up @@ -338,5 +339,5 @@ function runArchiveStatusChanged(): void {
}

function setRunIsArchived(run: TeacherRun, isArchived: boolean): void {
run.project.isDeleted = isArchived;
run.isArchived = isArchived;
}

0 comments on commit cec8b19

Please sign in to comment.