Commit 529abbf8 authored by peterhegman's avatar peterhegman

Refactor specs to use shared variable

parent 17dc93d6
......@@ -44,18 +44,16 @@ describe('Vuex members mutations', () => {
describe('when error has a message', () => {
it('shows error message', () => {
const error = new Error('Request failed with status code 422');
const message =
'User email "john.smith@gmail.com" does not match the allowed domain of example.com';
error.response = {
data: {
message:
'User email "john.smith@gmail.com" does not match the allowed domain of example.com',
},
data: { message },
};
mutations[types.RECEIVE_MEMBER_ROLE_ERROR](state, { error });
expect(state.showError).toBe(true);
expect(state.errorMessage).toBe(
'User email "john.smith@gmail.com" does not match the allowed domain of example.com',
);
expect(state.errorMessage).toBe(message);
});
});
});
......@@ -90,18 +88,16 @@ describe('Vuex members mutations', () => {
describe('when error has a message', () => {
it('shows error message', () => {
const error = new Error('Request failed with status code 422');
const message =
'User email "john.smith@gmail.com" does not match the allowed domain of example.com';
error.response = {
data: {
message:
'User email "john.smith@gmail.com" does not match the allowed domain of example.com',
},
data: { message },
};
mutations[types.RECEIVE_MEMBER_EXPIRATION_ERROR](state, { error });
expect(state.showError).toBe(true);
expect(state.errorMessage).toBe(
'User email "john.smith@gmail.com" does not match the allowed domain of example.com',
);
expect(state.errorMessage).toBe(message);
});
});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment