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: {},
|
||||
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'];
|
||||
|
||||
@ -123,7 +123,7 @@ describe('actions', () => {
|
||||
id: '1'
|
||||
}
|
||||
};
|
||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue({isSuccess: false});
|
||||
jest.spyOn(api, 'addProjectMembersRequest').mockReturnValue(Promise.resolve(<RequestResponse<null>>{isSuccess: false}));
|
||||
|
||||
const emails = ['1', '2'];
|
||||
|
||||
@ -138,7 +138,7 @@ describe('actions', () => {
|
||||
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 emails = ['1', '2'];
|
||||
@ -155,7 +155,7 @@ describe('actions', () => {
|
||||
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 emails = ['1', '2'];
|
||||
@ -208,11 +208,11 @@ describe('actions', () => {
|
||||
},
|
||||
joinedAt: '1'
|
||||
};
|
||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: true,
|
||||
data: [projectMemberMockModel]
|
||||
});
|
||||
jest.spyOn(api, 'fetchProjectMembersRequest').mockReturnValue(
|
||||
Promise.resolve(<RequestResponse<TeamMemberModel[]>>{
|
||||
isSuccess: true,
|
||||
data: [projectMemberMockModel]
|
||||
}));
|
||||
|
||||
const dispatchResponse = await projectMembersModule.actions.fetchProjectMembers({
|
||||
state,
|
||||
@ -240,7 +240,11 @@ describe('actions', () => {
|
||||
}
|
||||
};
|
||||
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({
|
||||
state,
|
||||
|
@ -85,14 +85,15 @@ describe('actions', () => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
it('success update account', async () => {
|
||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: true, data: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
});
|
||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||
Promise.resolve(<RequestResponse<User>>{
|
||||
isSuccess: true, data: {
|
||||
firstName: 'firstName',
|
||||
lastName: 'lastName',
|
||||
email: 'email',
|
||||
}
|
||||
})
|
||||
);
|
||||
const commit = jest.fn();
|
||||
const user = {
|
||||
firstName: '',
|
||||
@ -112,9 +113,10 @@ describe('actions', () => {
|
||||
|
||||
it('error update account', async () => {
|
||||
jest.spyOn(api, 'updateAccountRequest').mockReturnValue(
|
||||
{
|
||||
isSuccess: false
|
||||
});
|
||||
Promise.resolve(<RequestResponse<User>>{
|
||||
isSuccess: false
|
||||
})
|
||||
);
|
||||
const commit = jest.fn();
|
||||
const user = {
|
||||
firstName: '',
|
||||
@ -129,7 +131,11 @@ describe('actions', () => {
|
||||
});
|
||||
|
||||
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 updatePasswordModel = {oldPassword: 'o', newPassword: 'n'};
|
||||
|
||||
@ -139,7 +145,12 @@ describe('actions', () => {
|
||||
});
|
||||
|
||||
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 password = '';
|
||||
|
||||
@ -149,14 +160,16 @@ describe('actions', () => {
|
||||
});
|
||||
|
||||
it('success get user', async () => {
|
||||
jest.spyOn(api, 'getUserRequest').mockReturnValue({
|
||||
isSuccess: true,
|
||||
data: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
});
|
||||
jest.spyOn(api, 'getUserRequest').mockReturnValue(
|
||||
Promise.resolve(<RequestResponse<User>>{
|
||||
isSuccess: true,
|
||||
data: {
|
||||
firstName: '',
|
||||
lastName: '',
|
||||
email: ''
|
||||
}
|
||||
})
|
||||
);
|
||||
const commit = jest.fn();
|
||||
|
||||
const requestResponse = await usersModule.actions.getUser({commit});
|
||||
@ -165,7 +178,11 @@ describe('actions', () => {
|
||||
});
|
||||
|
||||
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 requestResponse = await usersModule.actions.getUser({commit});
|
||||
|
Loading…
Reference in New Issue
Block a user