Skip to content

Commit

Permalink
test: fix user mock on library switch service
Browse files Browse the repository at this point in the history
Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
Garfield-fr committed Dec 11, 2020
1 parent 8de2f14 commit c7cfbf4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('LibrarySwitchService', () => {

it('should be able to switch libraries', () => {
if (user.hasRole('system_librarian')) {
user.roles = user.roles.filter(role => role !== 'system_librarian');
user.roles = user.roles.filter((role: string) => role !== 'system_librarian');
}
librarySwitchService.librarySwitch$.subscribe((u: User) => {
expect(u.currentLibrary).toEqual('2');
Expand All @@ -83,6 +83,9 @@ describe('LibrarySwitchService', () => {
});

it('should have an exception if the library does not exist in the list (librarian).', () => {
if (user.hasRole('system_librarian')) {
user.roles = user.roles.filter((role: string) => role !== 'system_librarian');
}
expect(() => {
librarySwitchService.switch('3');
}).toThrowError(LibrarySwitchError);
Expand Down

0 comments on commit c7cfbf4

Please sign in to comment.