Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("should add a director with the given information", async () => {
when(directorRepository.saveDirector(testDirectorWithoutId)).thenReturn(Promise.resolve(testDirectorWithId));
const actual = await serviceUnderTest.save(testDirectorWithoutId);
expect(actual).to.equal(testDirectorWithId);
});
it("should return the 4 dummy directors", async () => {
when(directorRepository.getAllDirectors()).thenReturn(Promise.resolve(testDirectorList));
const actual = await serviceUnderTest.findAll();
expect(actual).to.have.length(5);
});
});
it("should call the delete on the repository", async () => {
when(directorRepository.deleteDirectorWithId(testId)).thenReturn(Promise.resolve());
await serviceUnderTest.delete(testId);
verify(directorRepository.deleteDirectorWithId(testId)).called();
});
constructor() {
this.mockedUserService = mock(UserService);
this.mockedNoticeService = mock(NoticeService);
const updatedUser = new User({
id: 'user01',
name: 'Updated Name',
username: 'updatedusername'
});
when(this.mockedUserService.onlineUpdateAttributes(anything(), anything())).thenResolve(updatedUser);
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, NoopAnimationsModule, UICommonModule],
declarations: [SaUserEntryComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
providers: [
{ provide: UserService, useFactory: () => instance(this.mockedUserService) },
{ provide: NoticeService, useFactory: () => instance(this.mockedNoticeService) },
DatePipe
]
});
this.fixture = TestBed.createComponent(SaUserEntryComponent);
this.component = this.fixture.componentInstance;
}