Satellite web unit tests fix (#1335)
* Fixed satellite web store unit test return value. * Fixed satellite web 'user' store unit test return value.
This commit is contained in:
parent
4c1db6c6f6
commit
f552e7bc08
@ -108,7 +108,7 @@ describe('actions', () => {
|
|||||||
searchParameters: {},
|
searchParameters: {},
|
||||||
pagination: {limit: 20, offset: 0}
|
pagination: {limit: 20, offset: 0}
|
||||||
};
|
};
|
||||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue({isSuccess: true});
|
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue(Promise.resolve(<RequestResponse<null>>{isSuccess: true}));
|
||||||
|
|
||||||
const emails = ['1', '2'];
|
const emails = ['1', '2'];
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ describe('actions', () => {
|
|||||||
id: '1'
|
id: '1'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue({isSuccess: false});
|
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue(Promise.resolve(<RequestResponse<null>>{isSuccess: false}));
|
||||||
|
|
||||||
const emails = ['1', '2'];
|
const emails = ['1', '2'];
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ describe('actions', () => {
|
|||||||
id: '1'
|
id: '1'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue({isSuccess: true});
|
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue(Promise.resolve(<RequestResponse<null>>{isSuccess: true}));
|
||||||
|
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
const emails = ['1', '2'];
|
const emails = ['1', '2'];
|
||||||
@ -155,7 +155,7 @@ describe('actions', () => {
|
|||||||
id: '1'
|
id: '1'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue({isSuccess: false});
|
jest.spyOn(api, 'deleteProjectMembersRequest').mockReturnValue(Promise.resolve(<RequestResponse<null>>{isSuccess: false}));
|
||||||
|
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
const emails = ['1', '2'];
|
const emails = ['1', '2'];
|
||||||
@ -208,11 +208,11 @@ describe('actions', () => {
|
|||||||
},
|
},
|
||||||
joinedAt: '1'
|
joinedAt: '1'
|
||||||
};
|
};
|
||||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
|
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
|
||||||
{
|
Promise.resolve(<RequestResponse<TeamMemberModel[]>>{
|
||||||
isSuccess: true,
|
isSuccess: true,
|
||||||
data: [projectMemberMockModel]
|
data: [projectMemberMockModel]
|
||||||
});
|
}));
|
||||||
|
|
||||||
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
||||||
state,
|
state,
|
||||||
@ -240,7 +240,11 @@ describe('actions', () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue({isSuccess: false});
|
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
|
||||||
|
Promise.resolve(<RequestResponse<TeamMemberModel[]>>{
|
||||||
|
isSuccess: false,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
||||||
state,
|
state,
|
||||||
|
@ -85,14 +85,15 @@ describe('actions', () => {
|
|||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
});
|
});
|
||||||
it('success update account', async () => {
|
it('success update account', async () => {
|
||||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||||
{
|
Promise.resolve(<RequestResponse<User>>{
|
||||||
isSuccess: true, data: {
|
isSuccess: true, data: {
|
||||||
firstName: 'firstName',
|
firstName: 'firstName',
|
||||||
lastName: 'lastName',
|
lastName: 'lastName',
|
||||||
email: 'email',
|
email: 'email',
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
);
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
const user = {
|
const user = {
|
||||||
firstName: '',
|
firstName: '',
|
||||||
@ -112,9 +113,10 @@ describe('actions', () => {
|
|||||||
|
|
||||||
it('error update account', async () => {
|
it('error update account', async () => {
|
||||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||||
{
|
Promise.resolve(<RequestResponse<User>>{
|
||||||
isSuccess: false
|
isSuccess: false
|
||||||
});
|
})
|
||||||
|
);
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
const user = {
|
const user = {
|
||||||
firstName: '',
|
firstName: '',
|
||||||
@ -129,7 +131,11 @@ describe('actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('password change', async () => {
|
it('password change', async () => {
|
||||||
jest.spyOn(api, 'changePasswordRequest').mockReturnValue({isSuccess: true});
|
jest.spyOn(api, 'changePasswordRequest').mockReturnValue(
|
||||||
|
Promise.resolve(<RequestResponse<null>>{
|
||||||
|
isSuccess: true
|
||||||
|
})
|
||||||
|
);
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
const updatePasswordModel = {oldPassword: 'o', newPassword: 'n'};
|
const updatePasswordModel = {oldPassword: 'o', newPassword: 'n'};
|
||||||
|
|
||||||
@ -139,7 +145,12 @@ describe('actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('delete account', async () => {
|
it('delete account', async () => {
|
||||||
jest.spyOn(api, 'deleteAccountRequest').mockReturnValue({isSuccess: true});
|
jest.spyOn(api, 'deleteAccountRequest').mockReturnValue(
|
||||||
|
Promise.resolve(<RequestResponse<null>>{
|
||||||
|
isSuccess: true
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
const password = '';
|
const password = '';
|
||||||
|
|
||||||
@ -149,14 +160,16 @@ describe('actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('success get user', async () => {
|
it('success get user', async () => {
|
||||||
jest.spyOn(api, 'getUserRequest').mockReturnValue({
|
jest.spyOn(api, 'getUserRequest').mockReturnValue(
|
||||||
isSuccess: true,
|
Promise.resolve(<RequestResponse<User>>{
|
||||||
data: {
|
isSuccess: true,
|
||||||
firstName: '',
|
data: {
|
||||||
lastName: '',
|
firstName: '',
|
||||||
email: ''
|
lastName: '',
|
||||||
}
|
email: ''
|
||||||
});
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
|
||||||
const requestResponse = await usersModule.actions.getUser({commit});
|
const requestResponse = await usersModule.actions.getUser({commit});
|
||||||
@ -165,7 +178,11 @@ describe('actions', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('error get user', async () => {
|
it('error get user', async () => {
|
||||||
jest.spyOn(api, 'getUserRequest').mockReturnValue({isSuccess: false});
|
jest.spyOn(api, 'getUserRequest').mockReturnValue(
|
||||||
|
Promise.resolve(<RequestResponse<User>>{
|
||||||
|
isSuccess: false
|
||||||
|
})
|
||||||
|
);
|
||||||
const commit = jest.fn();
|
const commit = jest.fn();
|
||||||
|
|
||||||
const requestResponse = await usersModule.actions.getUser({commit});
|
const requestResponse = await usersModule.actions.getUser({commit});
|
||||||
|
Loading…
Reference in New Issue
Block a user