Skip to content

Commit

Permalink
#931: fix MemberDetailComponent test
Browse files Browse the repository at this point in the history
  • Loading branch information
clean-coder committed Jul 29, 2024
1 parent 818e3aa commit 5973530
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions frontend/src/app/shared/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,21 @@ export const testUser: User = {
email: '[email protected]',
};

export const testOkrChampionUser: User = {
id: 1,
firstname: 'Hans',
lastname: 'Muster',
isOkrChampion: true,
userTeamList: [
{
id: 1,
team: team1,
isTeamAdmin: false,
},
],
email: '[email protected]',
};

export const users: User[] = [
testUser,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { BrowserModule } from '@angular/platform-browser';
import { SharedModule } from '../../shared/shared.module';
import { UserService } from '../../services/user.service';
import { testUser } from '../../shared/testData';
import { testOkrChampionUser, testUser } from '../../shared/testData';
import { AddUserTeamComponent } from '../add-user-team/add-user-team.component';
import { MatTableModule } from '@angular/material/table';
import { MatIconModule } from '@angular/material/icon';
Expand All @@ -31,6 +31,7 @@ describe('MemberDetailComponent', () => {

const userServiceMock = {
getUserById: jest.fn(),
getOrInitCurrentUser: jest.fn(),
getCurrentUser: jest.fn(),
reloadUsers: jest.fn(),
reloadCurrentUser: jest.fn(),
Expand Down Expand Up @@ -79,6 +80,7 @@ describe('MemberDetailComponent', () => {
component = fixture.componentInstance;

userServiceMock.getUserById.mockReturnValue(of(testUser));
userServiceMock.getOrInitCurrentUser.mockReturnValue(of(testOkrChampionUser));
userServiceMock.getCurrentUser.mockReturnValue(testUser);
userServiceMock.reloadCurrentUser.mockReturnValue(of(testUser));

Expand Down

0 comments on commit 5973530

Please sign in to comment.