Project

General

Profile

Bug #46450

mgr/dashboard: StatefulTabDirective unit test fails

Added by Volker Theile 7 months ago. Updated 7 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
dashboard/UI
Target version:
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
Yes
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature:

Description

StatefulTabDirective › should get and select active tab

    expect(received).toHaveBeenCalled()

    Matcher error: received value must be a mock or spy function

    Received has type:  function
    Received has value: [Function getItem]

      15 |     const directive = new StatefulTabDirective(nav);
      16 |     directive.ngOnInit();
    > 17 |     expect(window.localStorage.getItem).toHaveBeenCalled();
         |                                         ^
      18 |     expect(nav.select).toHaveBeenCalledWith('foo');
      19 |   });
      20 | 

      at src/app/shared/directives/stateful-tab.directive.spec.ts:17:41
      at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:386:30)
      at ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:117:43)
      at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:385:36)
      at Zone.run (node_modules/zone.js/dist/zone.js:143:47)

  ● StatefulTabDirective › should store active tab

    expect(received).toHaveBeenCalledWith(...expected)

    Matcher error: received value must be a mock or spy function

    Received has type:  function
    Received has value: [Function setItem]

      25 |     const event: NgbNavChangeEvent<string> = { activeId: '', nextId: 'xyz', preventDefault: null };
      26 |     directive.onNavChange(event);
    > 27 |     expect(window.localStorage.setItem).toHaveBeenCalledWith('tabset_bar', 'xyz');
         |                                         ^
      28 |   });
      29 | });
      30 | 

      at src/app/shared/directives/stateful-tab.directive.spec.ts:27:41
      at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:386:30)
      at ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/proxy.js:117:43)
      at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:385:36)
      at Zone.run (node_modules/zone.js/dist/zone.js:143:47)

History

#1 Updated by Volker Theile 7 months ago

  • Status changed from New to Fix Under Review
  • Pull request ID set to 36010

#2 Updated by Lenz Grimmer 7 months ago

  • Status changed from Fix Under Review to Resolved
  • Regression changed from No to Yes

Also available in: Atom PDF