Skip to content

Commit 241d8a3

Browse files
author
thegreatyamori
committed
test: TT-155 modify test input data
1 parent 3d5cd17 commit 241d8a3

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

src/app/modules/user/store/user.actions.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { User } from '../models/user';
55
describe('Actions for User', () => {
66
it('LoadUserSuccess type is UserActionTypes.LOAD_USER_SUCCESS', () => {
77
const user: User = {
8-
name: 'Jerson Morocho',
9-
email: 'jerson.morocho@ioet.com',
8+
name: 'Unknown Name',
9+
email: 'example@mail.com',
1010
roles: [],
1111
groups: [],
12-
id: 'dd4a1571-b025-41c9-b35f-810841b43134',
13-
tenant_id: 'cc925a5d-9644-4a4f-8d99-0bee49aadd05',
12+
id: 'dummy_id_load',
13+
tenant_id: 'dummy_tenant_id_load',
1414
deleted: ''
1515
};
1616

src/app/modules/user/store/user.effects.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ describe('UserEffects', () => {
1313
let effects: UserEffects;
1414
let service: UserService;
1515
const userInfo: User = {
16-
name: 'Jerson Morocho',
17-
email: 'jerson.morocho@ioet.com',
16+
name: 'Unknown Name',
17+
email: 'example@mail.com',
1818
roles: [],
1919
groups: [],
20-
id: 'cc925a5d-9644-4a4f-8d99-0bee49aadd05',
20+
id: 'dummy_tenant_id_load',
2121
tenant_id: null,
2222
deleted: null
2323
};
@@ -37,7 +37,7 @@ describe('UserEffects', () => {
3737
});
3838

3939
it('action type is LOAD_USER_SUCCESS when service is executed successfully', async () => {
40-
const userId = 'dd4a1571-b025-41c9-b35f-810841b43134';
40+
const userId = 'dummy_id_load';
4141
const serviceSpy = spyOn(service, 'loadUser');
4242

4343
actions$ = of(new LoadUser(userId));
@@ -49,7 +49,7 @@ describe('UserEffects', () => {
4949
});
5050

5151
it('action type is LOAD_USER_FAIL when service fail in execution', async () => {
52-
const userId = 'dd4a1571-b025-41c9-b35f-810841b43134';
52+
const userId = 'dummy_id_load';
5353
const serviceSpy = spyOn(service, 'loadUser');
5454

5555
actions$ = of(new LoadUser(userId));

src/app/modules/user/store/user.reducer.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('userReducer', () => {
1111
}
1212

1313
it('on LoadUser, state equal to initState', () => {
14-
const userId = 'dd4a1571-b025-41c9-b35f-810841b43134';
14+
const userId = 'dummy_id_load';
1515
const action = new LoadUser(userId);
1616
const state = userReducer(initState, action);
1717

@@ -20,11 +20,11 @@ describe('userReducer', () => {
2020

2121
it('on LoadUserSuccess, userFound is saved in store', () => {
2222
const userFound: User = {
23-
name: 'Jerson Morocho',
24-
email: 'jerson.morocho@ioet.com',
23+
name: 'Unknown Name',
24+
email: 'example@mail.com',
2525
roles: [],
2626
groups: [],
27-
id: 'dd4a1571-b025-41c9-b35f-810841b43134',
27+
id: 'dummy_id_load',
2828
tenant_id: null,
2929
deleted: null
3030
};

src/app/modules/user/store/user.selectors.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import { User } from '../models/user';
33

44
describe('UserSelectors', () => {
55
const userInfo: User = {
6-
name: 'Jerson Morocho',
7-
email: 'jerson.morocho@ioet.com',
6+
name: 'Unknown Name',
7+
email: 'example@mail.com',
88
roles: [],
99
groups: [],
10-
id: 'cc925a5d-9644-4a4f-8d99-0bee49aadd05',
10+
id: 'dummy_tenant_id_load',
1111
tenant_id: null,
1212
deleted: null
1313
};
1414

1515
it('should select user info', () => {
1616
const result = getUserInfo.projector(userInfo);
1717

18-
expect(userInfo.email).toEqual('jerson.morocho@ioet.com');
18+
expect(userInfo.email).toEqual('example@mail.com');
1919
});
2020

2121
});
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { createFeatureSelector, createSelector } from '@ngrx/store';
2+
import { User } from '../models/user';
23

34
const getUserState = createFeatureSelector<any>('user');
45

5-
export const getUserInfo = createSelector(getUserState, (state: any) => state);
6+
export const getUserInfo = createSelector(getUserState, (state: User) => state);
7+
export const getUserGroups = createSelector(getUserState, (state: User) => state.groups);

0 commit comments

Comments
 (0)