Skip to content

Commit

Permalink
add-initial-test
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricongjh committed Sep 10, 2023
1 parent ceb0bcf commit 6604a0c
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { of } from 'rxjs';
import { of, Observable } from 'rxjs';
import SpyInstance = jest.SpyInstance;
import { CourseService } from '../../../services/course.service';
import { FeedbackSessionsService } from '../../../services/feedback-sessions.service';
Expand Down Expand Up @@ -429,4 +429,22 @@ describe('InstructorSessionsPageComponent', () => {
expect(fixture).toMatchSnapshot();
});

it('should call copySingleSession when requestList contains only one item', () => {
const result = {
sessionToCopyRowIndex: 0,
newFeedbackSessionName: 'New feedback session',
copyToCourseList: [],
sessionToCopyCourseId: '1'

Check failure on line 437 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing trailing comma

Check failure on line 437 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing trailing comma

Check failure on line 437 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing trailing comma

Check failure on line 437 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing trailing comma
}

Check failure on line 438 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing semicolon

Check failure on line 438 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing semicolon

Check failure on line 438 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing semicolon

Check failure on line 438 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing semicolon
const mockRequest = of({} as FeedbackSession)

Check failure on line 439 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing semicolon

Check failure on line 439 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing semicolon

Check failure on line 439 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing semicolon

Check failure on line 439 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing semicolon
jest.spyOn(component, 'createSessionCopyRequestsFromRowModel').mockReturnValue([mockRequest]);
const copySingleSessionSpy = jest.spyOn(component, 'copySingleSession');

component.copySessionEventHandler(result);

expect(component.createSessionCopyRequestsFromRowModel).toHaveBeenCalled();
expect(copySingleSessionSpy).toHaveBeenCalledWith(expect.any(Observable), component.modifiedTimestampsModal);
expect(component.isCopyOtherSessionLoading).toBeFalsy()

Check failure on line 447 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing semicolon

Check failure on line 447 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing semicolon

Check failure on line 447 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (ubuntu-latest)

Missing semicolon

Check failure on line 447 in src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.spec.ts

View workflow job for this annotation

GitHub Actions / lint (windows-latest)

Missing semicolon
});

});

0 comments on commit 6604a0c

Please sign in to comment.