From: Volker Theile Date: Fri, 10 Jul 2020 11:42:53 +0000 (+0200) Subject: mgr/dashboard: StatefulTabDirective unit test fails X-Git-Tag: wip-pdonnell-testing-20200918.022351~704^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d32b45d8355d7d423080d7ccb19e5cd7d7885969;p=ceph-ci.git mgr/dashboard: StatefulTabDirective unit test fails Fixes: https://tracker.ceph.com/issues/46450 Signed-off-by: Volker Theile --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts index 70ecb1adb88..bbac89aa446 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/directives/stateful-tab.directive.spec.ts @@ -11,19 +11,18 @@ describe('StatefulTabDirective', () => { it('should get and select active tab', () => { const nav = new NgbNav('tablist', new NgbNavConfig(), null, null); spyOn(nav, 'select'); - spyOn(window.localStorage, 'getItem').and.returnValue('foo'); const directive = new StatefulTabDirective(nav); + directive.cdStatefulTab = 'bar'; + window.localStorage.setItem('tabset_bar', 'foo'); directive.ngOnInit(); - expect(window.localStorage.getItem).toHaveBeenCalled(); expect(nav.select).toHaveBeenCalledWith('foo'); }); it('should store active tab', () => { - spyOn(window.localStorage, 'setItem'); const directive = new StatefulTabDirective(null); directive.cdStatefulTab = 'bar'; const event: NgbNavChangeEvent = { activeId: '', nextId: 'xyz', preventDefault: null }; directive.onNavChange(event); - expect(window.localStorage.setItem).toHaveBeenCalledWith('tabset_bar', 'xyz'); + expect(window.localStorage.getItem('tabset_bar')).toBe('xyz'); }); });