Skip to content

Commit

Permalink
adjust test
Browse files Browse the repository at this point in the history
  • Loading branch information
rabeatwork committed May 3, 2024
1 parent 0f23fcc commit 6d8b8c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ describe('SidebarCardComponent', () => {

it('should store route on click', () => {
jest.spyOn(component, 'emitStoreLastSelectedItem');
jest.spyOn(component, 'forceReload');
const element: HTMLElement = fixture.nativeElement.querySelector('#test-sidebar-card');
element.click();
fixture.detectChanges();
expect(component.emitStoreLastSelectedItem).toHaveBeenCalledWith(component.sidebarItem.id);
expect(component.forceReload).toHaveBeenCalled();
});

it('should navigate to the item URL on click', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/test/javascript/spec/helpers/mocks/mock-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { NavigationEnd, RouterEvent, RouterState, UrlTree } from '@angular/route
export class MockRouter {
url = '/';
navigateByUrl = jest.fn().mockReturnValue(true);
navigate = jest.fn().mockReturnValue(true);
navigate = jest.fn().mockReturnValue(Promise.resolve(true));
routerState: RouterState;
createUrlTree = jest.fn().mockReturnValue({ path: 'testValue' } as unknown as UrlTree);
serializeUrl = jest.fn().mockReturnValue('testValue');
Expand Down

0 comments on commit 6d8b8c1

Please sign in to comment.