0

I want to write test case for the following .I have tried with the following code but didnt work at all.

Been Searching for this since few hours but no solution.

  ngOnInit(): void {
        this.isDarkTheme$ = this.themeService.getDarkTheme();
        this.store.select(selectUser).subscribe((data) => {
          this.role = data.role.name;
          this.firstName = data.firstName;
          this.lastName = data.lastName;
          this.menuItems = menuItems(this.role);
        });
      }

describe('test', () => {
    it('should get userData from the store', () => {
      const role:string = "admin";
      const firstName:string = "Jim";
      const lastName:string = "Becker";
      const menuItems:MenuItems[] = [
        {
          key: 'dashboard',
          label: 'DASHBOARD',
          url: '/tiles/dashboard',
          icon: 'pi pi-fw pi-sign-out',
        },
        {
          key: 'teams',
          label: 'TEAMS',
          url: '/tiles/teams',
          icon: 'pi pi-fw pi-users',
        },
      ];
      const mockHomeState = store.overrideSelector(
        selectUser,
      menuItems
      );

      component.ngOnInit();
    });
  });
Ajax S
  • 1
  • 2
  • Please provide us your effort as well. I very well understand that you need guidance but what you are asking is a solution (which comes under freelancing work). So, please update your question accordingly to avoid getting it closed soon – Shashank Vivek Feb 26 '21 at 13:14
  • Updated with required code .Please do provide a solution if there's a something that am missing – Ajax S Feb 26 '21 at 15:32

0 Answers0