summaryrefslogtreecommitdiff
path: root/spec/frontend/__helpers__
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/__helpers__')
-rw-r--r--spec/frontend/__helpers__/init_vue_mr_page_helper.js3
-rw-r--r--spec/frontend/__helpers__/test_apollo_link.js4
-rw-r--r--spec/frontend/__helpers__/vuex_action_helper_spec.js7
3 files changed, 8 insertions, 6 deletions
diff --git a/spec/frontend/__helpers__/init_vue_mr_page_helper.js b/spec/frontend/__helpers__/init_vue_mr_page_helper.js
index 83ed0a869dc..d01affdaeac 100644
--- a/spec/frontend/__helpers__/init_vue_mr_page_helper.js
+++ b/spec/frontend/__helpers__/init_vue_mr_page_helper.js
@@ -1,5 +1,6 @@
import MockAdapter from 'axios-mock-adapter';
import axios from '~/lib/utils/axios_utils';
+import { HTTP_STATUS_OK } from '~/lib/utils/http_status';
import initMRPage from '~/mr_notes';
import { getDiffFileMock } from '../diffs/mock_data/diff_file';
import { userDataMock, notesDataMock, noteableDataMock } from '../notes/mock_data';
@@ -37,7 +38,7 @@ export default function initVueMRPage() {
mrTestEl.appendChild(diffsAppEl);
const mock = new MockAdapter(axios);
- mock.onGet(diffsAppEndpoint).reply(200, {
+ mock.onGet(diffsAppEndpoint).reply(HTTP_STATUS_OK, {
branch_name: 'foo',
diff_files: [getDiffFileMock()],
});
diff --git a/spec/frontend/__helpers__/test_apollo_link.js b/spec/frontend/__helpers__/test_apollo_link.js
index eab0c2de212..d9e7f5fc348 100644
--- a/spec/frontend/__helpers__/test_apollo_link.js
+++ b/spec/frontend/__helpers__/test_apollo_link.js
@@ -18,7 +18,7 @@ const FOO_QUERY = gql`
*
* @returns Promise resolving to the resulting operation after running the subjectLink
*/
-export const testApolloLink = (subjectLink, options = {}) =>
+export const testApolloLink = (subjectLink, options = {}, query = FOO_QUERY) =>
new Promise((resolve) => {
const { context = {} } = options;
@@ -38,6 +38,6 @@ export const testApolloLink = (subjectLink, options = {}) =>
// Trigger a query so the ApolloLink chain will be executed.
client.query({
context,
- query: FOO_QUERY,
+ query,
});
});
diff --git a/spec/frontend/__helpers__/vuex_action_helper_spec.js b/spec/frontend/__helpers__/vuex_action_helper_spec.js
index 182aea9c1c5..4bd21ff150a 100644
--- a/spec/frontend/__helpers__/vuex_action_helper_spec.js
+++ b/spec/frontend/__helpers__/vuex_action_helper_spec.js
@@ -1,6 +1,7 @@
import MockAdapter from 'axios-mock-adapter';
import { TEST_HOST } from 'helpers/test_constants';
import axios from '~/lib/utils/axios_utils';
+import { HTTP_STATUS_INTERNAL_SERVER_ERROR, HTTP_STATUS_OK } from '~/lib/utils/http_status';
import testActionFn from './vuex_action_helper';
const testActionFnWithOptionsArg = (...args) => {
@@ -101,7 +102,7 @@ describe.each([testActionFn, testActionFnWithOptionsArg])(
};
it('returns original data of successful promise while checking actions/mutations', async () => {
- mock.onGet(TEST_HOST).replyOnce(200, 42);
+ mock.onGet(TEST_HOST).replyOnce(HTTP_STATUS_OK, 42);
assertion = { mutations: [{ type: 'SUCCESS' }], actions: [{ type: 'ACTION' }] };
@@ -110,7 +111,7 @@ describe.each([testActionFn, testActionFnWithOptionsArg])(
});
it('returns original error of rejected promise while checking actions/mutations', async () => {
- mock.onGet(TEST_HOST).replyOnce(500, '');
+ mock.onGet(TEST_HOST).replyOnce(HTTP_STATUS_INTERNAL_SERVER_ERROR, '');
assertion = { mutations: [{ type: 'ERROR' }], actions: [{ type: 'ACTION' }] };
@@ -137,7 +138,7 @@ describe.each([testActionFn, testActionFnWithOptionsArg])(
});
};
- mock.onGet(TEST_HOST).replyOnce(200, 42);
+ mock.onGet(TEST_HOST).replyOnce(HTTP_STATUS_OK, 42);
assertion = { mutations: [{ type: 'SUCCESS' }], actions: [{ type: 'ACTION' }] };