Commit 6c70491d authored by mfluharty's avatar mfluharty

Use not found constant in more places

Use STATUS_NOT_FOUND in code quality report actions
and related component specs and store specs
parent 189b5e69
import pollUntilComplete from '~/lib/utils/poll_until_complete';
import { STATUS_NOT_FOUND } from '../../constants';
import * as types from './mutation_types';
import { parseCodeclimateMetrics } from './utils/codequality_parser';
......@@ -9,7 +10,7 @@ export const fetchReports = ({ state, dispatch, commit }) => {
return pollUntilComplete(state.reportsPath)
.then(({ data }) => {
if (data.status === 'not_found') {
if (data.status === STATUS_NOT_FOUND) {
return dispatch('receiveReportsError', data);
}
return dispatch('receiveReportsSuccess', {
......
......@@ -3,6 +3,7 @@ import Vuex from 'vuex';
import CodequalityIssueBody from '~/reports/codequality_report/components/codequality_issue_body.vue';
import GroupedCodequalityReportsApp from '~/reports/codequality_report/grouped_codequality_reports_app.vue';
import { getStoreConfig } from '~/reports/codequality_report/store';
import { STATUS_NOT_FOUND } from '~/reports/constants';
import { parsedReportIssues } from './mock_data';
const localVue = createLocalVue();
......@@ -140,7 +141,7 @@ describe('Grouped code quality reports app', () => {
describe('when base report was not found', () => {
beforeEach(() => {
mockStore.state.status = 'not_found';
mockStore.state.status = STATUS_NOT_FOUND;
});
it('renders a help icon with more information', () => {
......
......@@ -5,6 +5,7 @@ import axios from '~/lib/utils/axios_utils';
import createStore from '~/reports/codequality_report/store';
import * as actions from '~/reports/codequality_report/store/actions';
import * as types from '~/reports/codequality_report/store/mutation_types';
import { STATUS_NOT_FOUND } from '~/reports/constants';
import { reportIssues, parsedReportIssues } from '../mock_data';
const pollInterval = 123;
......@@ -91,7 +92,7 @@ describe('Codequality Reports actions', () => {
describe('when base report is not found', () => {
it('commits REQUEST_REPORTS and dispatches receiveReportsError', (done) => {
const data = { status: 'not_found' };
const data = { status: STATUS_NOT_FOUND };
mock.onGet(`${TEST_HOST}/codequality_reports.json`).reply(200, data);
testAction(
......
import createStore from '~/reports/codequality_report/store';
import * as getters from '~/reports/codequality_report/store/getters';
import { LOADING, ERROR, SUCCESS } from '~/reports/constants';
import { LOADING, ERROR, SUCCESS, STATUS_NOT_FOUND } from '~/reports/constants';
describe('Codequality reports store getters', () => {
let localState;
......@@ -78,7 +78,7 @@ describe('Codequality reports store getters', () => {
describe('codequalityPopover', () => {
describe('when base report is not available', () => {
it('returns a popover with a documentation link', () => {
localState.status = 'not_found';
localState.status = STATUS_NOT_FOUND;
localState.helpPath = 'codequality_help.html';
expect(getters.codequalityPopover(localState).title).toEqual(
......
import createStore from '~/reports/codequality_report/store';
import mutations from '~/reports/codequality_report/store/mutations';
import { STATUS_NOT_FOUND } from '~/reports/constants';
describe('Codequality Reports mutations', () => {
let localState;
......@@ -82,7 +83,7 @@ describe('Codequality Reports mutations', () => {
});
it('sets status based on error object', () => {
const error = { status: 'not_found' };
const error = { status: STATUS_NOT_FOUND };
mutations.RECEIVE_REPORTS_ERROR(localState, error);
expect(localState.status).toEqual(error.status);
......
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