summaryrefslogtreecommitdiff
path: root/spec/javascripts/reports
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/reports')
-rw-r--r--spec/javascripts/reports/components/grouped_test_reports_app_spec.js239
-rw-r--r--spec/javascripts/reports/components/modal_open_name_spec.js47
-rw-r--r--spec/javascripts/reports/components/modal_spec.js54
-rw-r--r--spec/javascripts/reports/components/summary_row_spec.js37
-rw-r--r--spec/javascripts/reports/components/test_issue_body_spec.js72
-rw-r--r--spec/javascripts/reports/mock_data/mock_data.js8
-rw-r--r--spec/javascripts/reports/mock_data/new_and_fixed_failures_report.json55
-rw-r--r--spec/javascripts/reports/mock_data/new_errors_report.json38
-rw-r--r--spec/javascripts/reports/mock_data/new_failures_report.json38
-rw-r--r--spec/javascripts/reports/mock_data/no_failures_report.json28
-rw-r--r--spec/javascripts/reports/mock_data/resolved_failures.json58
-rw-r--r--spec/javascripts/reports/store/actions_spec.js171
-rw-r--r--spec/javascripts/reports/store/mutations_spec.js126
13 files changed, 0 insertions, 971 deletions
diff --git a/spec/javascripts/reports/components/grouped_test_reports_app_spec.js b/spec/javascripts/reports/components/grouped_test_reports_app_spec.js
deleted file mode 100644
index bafc47c952a..00000000000
--- a/spec/javascripts/reports/components/grouped_test_reports_app_spec.js
+++ /dev/null
@@ -1,239 +0,0 @@
-import Vue from 'vue';
-import MockAdapter from 'axios-mock-adapter';
-import axios from '~/lib/utils/axios_utils';
-import state from '~/reports/store/state';
-import component from '~/reports/components/grouped_test_reports_app.vue';
-import mountComponent from '../../helpers/vue_mount_component_helper';
-import newFailedTestReports from '../mock_data/new_failures_report.json';
-import newErrorsTestReports from '../mock_data/new_errors_report.json';
-import successTestReports from '../mock_data/no_failures_report.json';
-import mixedResultsTestReports from '../mock_data/new_and_fixed_failures_report.json';
-import resolvedFailures from '../mock_data/resolved_failures.json';
-
-describe('Grouped Test Reports App', () => {
- let vm;
- let mock;
- const Component = Vue.extend(component);
-
- beforeEach(() => {
- mock = new MockAdapter(axios);
- });
-
- afterEach(() => {
- vm.$store.replaceState(state());
- vm.$destroy();
- mock.restore();
- });
-
- describe('with success result', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(200, successTestReports, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders success summary text', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary contained no changed test results out of 11 total tests',
- );
-
- expect(vm.$el.textContent).toContain(
- 'rspec:pg found no changed test results out of 8 total tests',
- );
-
- expect(vm.$el.textContent).toContain(
- 'java ant found no changed test results out of 3 total tests',
- );
- done();
- }, 0);
- });
- });
-
- describe('with 204 result', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(204, {}, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders success summary text', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.gl-spinner')).not.toBeNull();
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary results are being parsed',
- );
-
- done();
- }, 0);
- });
- });
-
- describe('with new failed result', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(200, newFailedTestReports, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders failed summary text + new badge', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary contained 2 failed out of 11 total tests',
- );
-
- expect(vm.$el.textContent).toContain('rspec:pg found 2 failed out of 8 total tests');
-
- expect(vm.$el.textContent).toContain('New');
- expect(vm.$el.textContent).toContain(
- 'java ant found no changed test results out of 3 total tests',
- );
- done();
- }, 0);
- });
- });
-
- describe('with new error result', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(200, newErrorsTestReports, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders error summary text + new badge', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary contained 2 errors out of 11 total tests',
- );
-
- expect(vm.$el.textContent).toContain('karma found 2 errors out of 3 total tests');
-
- expect(vm.$el.textContent).toContain('New');
- expect(vm.$el.textContent).toContain(
- 'rspec:pg found no changed test results out of 8 total tests',
- );
- done();
- }, 0);
- });
- });
-
- describe('with mixed results', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(200, mixedResultsTestReports, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders summary text', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary contained 2 failed and 2 fixed test results out of 11 total tests',
- );
-
- expect(vm.$el.textContent).toContain(
- 'rspec:pg found 1 failed and 2 fixed test results out of 8 total tests',
- );
-
- expect(vm.$el.textContent).toContain('New');
- expect(vm.$el.textContent).toContain(' java ant found 1 failed out of 3 total tests');
- done();
- }, 0);
- });
- });
-
- describe('with resolved failures and resolved errors', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(200, resolvedFailures, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders summary text', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.gl-spinner')).toBeNull();
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary contained 4 fixed test results out of 11 total tests',
- );
-
- expect(vm.$el.textContent).toContain(
- 'rspec:pg found 4 fixed test results out of 8 total tests',
- );
- done();
- }, 0);
- });
-
- it('renders resolved failures', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.report-block-container').textContent).toContain(
- resolvedFailures.suites[0].resolved_failures[0].name,
- );
-
- expect(vm.$el.querySelector('.report-block-container').textContent).toContain(
- resolvedFailures.suites[0].resolved_failures[1].name,
- );
- done();
- }, 0);
- });
-
- it('renders resolved errors', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.report-block-container').textContent).toContain(
- resolvedFailures.suites[0].resolved_errors[0].name,
- );
-
- expect(vm.$el.querySelector('.report-block-container').textContent).toContain(
- resolvedFailures.suites[0].resolved_errors[1].name,
- );
- done();
- }, 0);
- });
- });
-
- describe('with error', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(500, {}, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders loading summary text with loading icon', done => {
- setTimeout(() => {
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary failed loading results',
- );
- done();
- }, 0);
- });
- });
-
- describe('while loading', () => {
- beforeEach(() => {
- mock.onGet('test_results.json').reply(200, {}, {});
- vm = mountComponent(Component, {
- endpoint: 'test_results.json',
- });
- });
-
- it('renders loading summary text with loading icon', done => {
- expect(vm.$el.querySelector('.gl-spinner')).not.toBeNull();
- expect(vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
- 'Test summary results are being parsed',
- );
-
- setTimeout(() => {
- done();
- }, 0);
- });
- });
-});
diff --git a/spec/javascripts/reports/components/modal_open_name_spec.js b/spec/javascripts/reports/components/modal_open_name_spec.js
deleted file mode 100644
index ae1fb2bf187..00000000000
--- a/spec/javascripts/reports/components/modal_open_name_spec.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import { mountComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
-import component from '~/reports/components/modal_open_name.vue';
-
-Vue.use(Vuex);
-
-describe('Modal open name', () => {
- const Component = Vue.extend(component);
- let vm;
-
- const store = new Vuex.Store({
- actions: {
- openModal: () => {},
- },
- state: {},
- mutations: {},
- });
-
- beforeEach(() => {
- vm = mountComponentWithStore(Component, {
- store,
- props: {
- issue: {
- title: 'Issue',
- },
- status: 'failed',
- },
- });
- });
-
- afterEach(() => {
- vm.$destroy();
- });
-
- it('renders the issue name', () => {
- expect(vm.$el.textContent.trim()).toEqual('Issue');
- });
-
- it('calls openModal actions when button is clicked', () => {
- spyOn(vm, 'openModal');
-
- vm.$el.click();
-
- expect(vm.openModal).toHaveBeenCalled();
- });
-});
diff --git a/spec/javascripts/reports/components/modal_spec.js b/spec/javascripts/reports/components/modal_spec.js
deleted file mode 100644
index ff046e64b6e..00000000000
--- a/spec/javascripts/reports/components/modal_spec.js
+++ /dev/null
@@ -1,54 +0,0 @@
-import Vue from 'vue';
-import component from '~/reports/components/modal.vue';
-import state from '~/reports/store/state';
-import mountComponent from '../../helpers/vue_mount_component_helper';
-import { trimText } from '../../helpers/text_helper';
-
-describe('Grouped Test Reports Modal', () => {
- const Component = Vue.extend(component);
- const modalDataStructure = state().modal.data;
-
- // populate data
- modalDataStructure.execution_time.value = 0.009411;
- modalDataStructure.system_output.value = 'Failure/Error: is_expected.to eq(3)\n\n';
- modalDataStructure.class.value = 'link';
-
- let vm;
-
- beforeEach(() => {
- vm = mountComponent(Component, {
- title: 'Test#sum when a is 1 and b is 2 returns summary',
- modalData: modalDataStructure,
- });
- });
-
- afterEach(() => {
- vm.$destroy();
- });
-
- it('renders code block', () => {
- expect(vm.$el.querySelector('code').textContent).toEqual(
- modalDataStructure.system_output.value,
- );
- });
-
- it('renders link', () => {
- expect(vm.$el.querySelector('.js-modal-link').getAttribute('href')).toEqual(
- modalDataStructure.class.value,
- );
-
- expect(trimText(vm.$el.querySelector('.js-modal-link').textContent)).toEqual(
- modalDataStructure.class.value,
- );
- });
-
- it('renders seconds', () => {
- expect(vm.$el.textContent).toContain(`${modalDataStructure.execution_time.value} s`);
- });
-
- it('render title', () => {
- expect(trimText(vm.$el.querySelector('.modal-title').textContent)).toEqual(
- 'Test#sum when a is 1 and b is 2 returns summary',
- );
- });
-});
diff --git a/spec/javascripts/reports/components/summary_row_spec.js b/spec/javascripts/reports/components/summary_row_spec.js
deleted file mode 100644
index a19fbad403c..00000000000
--- a/spec/javascripts/reports/components/summary_row_spec.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import Vue from 'vue';
-import mountComponent from 'spec/helpers/vue_mount_component_helper';
-import component from '~/reports/components/summary_row.vue';
-
-describe('Summary row', () => {
- const Component = Vue.extend(component);
- let vm;
-
- const props = {
- summary: 'SAST detected 1 new vulnerability and 1 fixed vulnerability',
- popoverOptions: {
- title: 'Static Application Security Testing (SAST)',
- content: '<a>Learn more about SAST</a>',
- },
- statusIcon: 'warning',
- };
-
- beforeEach(() => {
- vm = mountComponent(Component, props);
- });
-
- afterEach(() => {
- vm.$destroy();
- });
-
- it('renders provided summary', () => {
- expect(
- vm.$el.querySelector('.report-block-list-issue-description-text').textContent.trim(),
- ).toEqual(props.summary);
- });
-
- it('renders provided icon', () => {
- expect(vm.$el.querySelector('.report-block-list-icon span').classList).toContain(
- 'js-ci-status-icon-warning',
- );
- });
-});
diff --git a/spec/javascripts/reports/components/test_issue_body_spec.js b/spec/javascripts/reports/components/test_issue_body_spec.js
deleted file mode 100644
index 9c1cec4c9bc..00000000000
--- a/spec/javascripts/reports/components/test_issue_body_spec.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import Vue from 'vue';
-import component from '~/reports/components/test_issue_body.vue';
-import createStore from '~/reports/store';
-import { mountComponentWithStore } from '../../helpers/vue_mount_component_helper';
-import { trimText } from '../../helpers/text_helper';
-import { issue } from '../mock_data/mock_data';
-
-describe('Test Issue body', () => {
- let vm;
- const Component = Vue.extend(component);
- const store = createStore();
-
- const commonProps = {
- issue,
- status: 'failed',
- };
-
- afterEach(() => {
- vm.$destroy();
- });
-
- describe('on click', () => {
- it('calls openModal action', () => {
- vm = mountComponentWithStore(Component, {
- store,
- props: commonProps,
- });
-
- spyOn(vm, 'openModal');
-
- vm.$el.querySelector('button').click();
-
- expect(vm.openModal).toHaveBeenCalledWith({
- issue: commonProps.issue,
- });
- });
- });
-
- describe('is new', () => {
- beforeEach(() => {
- vm = mountComponentWithStore(Component, {
- store,
- props: Object.assign({}, commonProps, { isNew: true }),
- });
- });
-
- it('renders issue name', () => {
- expect(vm.$el.textContent).toContain(commonProps.issue.name);
- });
-
- it('renders new badge', () => {
- expect(trimText(vm.$el.querySelector('.badge').textContent)).toEqual('New');
- });
- });
-
- describe('not new', () => {
- beforeEach(() => {
- vm = mountComponentWithStore(Component, {
- store,
- props: commonProps,
- });
- });
-
- it('renders issue name', () => {
- expect(vm.$el.textContent).toContain(commonProps.issue.name);
- });
-
- it('does not renders new badge', () => {
- expect(vm.$el.querySelector('.badge')).toEqual(null);
- });
- });
-});
diff --git a/spec/javascripts/reports/mock_data/mock_data.js b/spec/javascripts/reports/mock_data/mock_data.js
deleted file mode 100644
index 0d90253bad2..00000000000
--- a/spec/javascripts/reports/mock_data/mock_data.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// eslint-disable-next-line import/prefer-default-export
-export const issue = {
- result: 'failure',
- name: 'Test#sum when a is 1 and b is 2 returns summary',
- execution_time: 0.009411,
- system_output:
- "Failure/Error: is_expected.to eq(3)\n\n expected: 3\n got: -1\n\n (compared using ==)\n./spec/test_spec.rb:12:in `block (4 levels) in \u003ctop (required)\u003e'",
-};
diff --git a/spec/javascripts/reports/mock_data/new_and_fixed_failures_report.json b/spec/javascripts/reports/mock_data/new_and_fixed_failures_report.json
deleted file mode 100644
index 6141e5433a6..00000000000
--- a/spec/javascripts/reports/mock_data/new_and_fixed_failures_report.json
+++ /dev/null
@@ -1,55 +0,0 @@
-{
- "status": "failed",
- "summary": { "total": 11, "resolved": 2, "errored": 0, "failed": 2 },
- "suites": [
- {
- "name": "rspec:pg",
- "status": "failed",
- "summary": { "total": 8, "resolved": 2, "errored": 0, "failed": 1 },
- "new_failures": [
- {
- "status": "failed",
- "name": "Test#subtract when a is 2 and b is 1 returns correct result",
- "execution_time": 0.00908,
- "system_output": "Failure/Error: is_expected.to eq(1)\n\n expected: 1\n got: 3\n\n (compared using ==)\n./spec/test_spec.rb:43:in `block (4 levels) in <top (required)>'"
- }
- ],
- "resolved_failures": [
- {
- "status": "success",
- "name": "Test#sum when a is 1 and b is 2 returns summary",
- "execution_time": 0.000318,
- "system_output": null
- },
- {
- "status": "success",
- "name": "Test#sum when a is 100 and b is 200 returns summary",
- "execution_time": 0.000074,
- "system_output": null
- }
- ],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- },
- {
- "name": "java ant",
- "status": "failed",
- "summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 1 },
- "new_failures": [],
- "resolved_failures": [],
- "existing_failures": [
- {
- "status": "failed",
- "name": "sumTest",
- "execution_time": 0.004,
- "system_output": "junit.framework.AssertionFailedError: expected:<3> but was:<-1>\n\tat CalculatorTest.sumTest(Unknown Source)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n"
- }
- ],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- }
- ]
-}
diff --git a/spec/javascripts/reports/mock_data/new_errors_report.json b/spec/javascripts/reports/mock_data/new_errors_report.json
deleted file mode 100644
index cebf98fdb63..00000000000
--- a/spec/javascripts/reports/mock_data/new_errors_report.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "summary": { "total": 11, "resolved": 0, "errored": 2, "failed": 0 },
- "suites": [
- {
- "name": "rspec:pg",
- "summary": { "total": 8, "resolved": 0, "errored": 0, "failed": 0 },
- "new_failures": [],
- "resolved_failures": [],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- },
- {
- "name": "karma",
- "summary": { "total": 3, "resolved": 0, "errored": 2, "failed": 0 },
- "new_failures": [],
- "resolved_failures": [],
- "existing_failures": [],
- "new_errors": [
- {
- "result": "error",
- "name": "Test#sum when a is 1 and b is 2 returns summary",
- "execution_time": 0.009411,
- "system_output": "Failed: Error in render: 'TypeError: Cannot read property 'status' of undefined'"
- },
- {
- "result": "error",
- "name": "Test#sum when a is 100 and b is 200 returns summary",
- "execution_time": 0.000162,
- "system_output": "Failed: Error in render: 'TypeError: Cannot read property 'length' of undefined'"
- }
- ],
- "resolved_errors": [],
- "existing_errors": []
- }
- ]
-}
diff --git a/spec/javascripts/reports/mock_data/new_failures_report.json b/spec/javascripts/reports/mock_data/new_failures_report.json
deleted file mode 100644
index 8b9c12c6271..00000000000
--- a/spec/javascripts/reports/mock_data/new_failures_report.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "summary": { "total": 11, "resolved": 0, "errored": 0, "failed": 2 },
- "suites": [
- {
- "name": "rspec:pg",
- "summary": { "total": 8, "resolved": 0, "errored": 0, "failed": 2 },
- "new_failures": [
- {
- "result": "failure",
- "name": "Test#sum when a is 1 and b is 2 returns summary",
- "execution_time": 0.009411,
- "system_output": "Failure/Error: is_expected.to eq(3)\n\n expected: 3\n got: -1\n\n (compared using ==)\n./spec/test_spec.rb:12:in `block (4 levels) in <top (required)>'"
- },
- {
- "result": "failure",
- "name": "Test#sum when a is 100 and b is 200 returns summary",
- "execution_time": 0.000162,
- "system_output": "Failure/Error: is_expected.to eq(300)\n\n expected: 300\n got: -100\n\n (compared using ==)\n./spec/test_spec.rb:21:in `block (4 levels) in <top (required)>'"
- }
- ],
- "resolved_failures": [],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- },
- {
- "name": "java ant",
- "summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 0 },
- "new_failures": [],
- "resolved_failures": [],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- }
- ]
-}
diff --git a/spec/javascripts/reports/mock_data/no_failures_report.json b/spec/javascripts/reports/mock_data/no_failures_report.json
deleted file mode 100644
index 7da9e0c6211..00000000000
--- a/spec/javascripts/reports/mock_data/no_failures_report.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "status": "success",
- "summary": { "total": 11, "resolved": 0, "errored": 0, "failed": 0 },
- "suites": [
- {
- "name": "rspec:pg",
- "status": "success",
- "summary": { "total": 8, "resolved": 0, "errored": 0, "failed": 0 },
- "new_failures": [],
- "resolved_failures": [],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- },
- {
- "name": "java ant",
- "status": "success",
- "summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 0 },
- "new_failures": [],
- "resolved_failures": [],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- }
- ]
-}
diff --git a/spec/javascripts/reports/mock_data/resolved_failures.json b/spec/javascripts/reports/mock_data/resolved_failures.json
deleted file mode 100644
index 49de6aa840b..00000000000
--- a/spec/javascripts/reports/mock_data/resolved_failures.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "status": "success",
- "summary": { "total": 11, "resolved": 4, "errored": 0, "failed": 0 },
- "suites": [
- {
- "name": "rspec:pg",
- "status": "success",
- "summary": { "total": 8, "resolved": 4, "errored": 0, "failed": 0 },
- "new_failures": [],
- "resolved_failures": [
- {
- "status": "success",
- "name": "Test#sum when a is 1 and b is 2 returns summary",
- "execution_time": 0.000411,
- "system_output": null,
- "stack_trace": null
- },
- {
- "status": "success",
- "name": "Test#sum when a is 100 and b is 200 returns summary",
- "execution_time": 7.6e-5,
- "system_output": null,
- "stack_trace": null
- }
- ],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [
- {
- "status": "success",
- "name": "Test#sum when a is 4 and b is 4 returns summary",
- "execution_time": 0.00342,
- "system_output": null,
- "stack_trace": null
- },
- {
- "status": "success",
- "name": "Test#sum when a is 40 and b is 400 returns summary",
- "execution_time": 0.0000231,
- "system_output": null,
- "stack_trace": null
- }
- ],
- "existing_errors": []
- },
- {
- "name": "java ant",
- "status": "success",
- "summary": { "total": 3, "resolved": 0, "errored": 0, "failed": 0 },
- "new_failures": [],
- "resolved_failures": [],
- "existing_failures": [],
- "new_errors": [],
- "resolved_errors": [],
- "existing_errors": []
- }
- ]
-}
diff --git a/spec/javascripts/reports/store/actions_spec.js b/spec/javascripts/reports/store/actions_spec.js
deleted file mode 100644
index 18fdb179597..00000000000
--- a/spec/javascripts/reports/store/actions_spec.js
+++ /dev/null
@@ -1,171 +0,0 @@
-import MockAdapter from 'axios-mock-adapter';
-import testAction from 'spec/helpers/vuex_action_helper';
-import { TEST_HOST } from 'spec/test_constants';
-import axios from '~/lib/utils/axios_utils';
-import {
- setEndpoint,
- requestReports,
- fetchReports,
- stopPolling,
- clearEtagPoll,
- receiveReportsSuccess,
- receiveReportsError,
- openModal,
- setModalData,
-} from '~/reports/store/actions';
-import state from '~/reports/store/state';
-import * as types from '~/reports/store/mutation_types';
-
-describe('Reports Store Actions', () => {
- let mockedState;
-
- beforeEach(() => {
- mockedState = state();
- });
-
- describe('setEndpoint', () => {
- it('should commit SET_ENDPOINT mutation', done => {
- testAction(
- setEndpoint,
- 'endpoint.json',
- mockedState,
- [{ type: types.SET_ENDPOINT, payload: 'endpoint.json' }],
- [],
- done,
- );
- });
- });
-
- describe('requestReports', () => {
- it('should commit REQUEST_REPORTS mutation', done => {
- testAction(requestReports, null, mockedState, [{ type: types.REQUEST_REPORTS }], [], done);
- });
- });
-
- describe('fetchReports', () => {
- let mock;
-
- beforeEach(() => {
- mockedState.endpoint = `${TEST_HOST}/endpoint.json`;
- mock = new MockAdapter(axios);
- });
-
- afterEach(() => {
- mock.restore();
- stopPolling();
- clearEtagPoll();
- });
-
- describe('success', () => {
- it('dispatches requestReports and receiveReportsSuccess ', done => {
- mock
- .onGet(`${TEST_HOST}/endpoint.json`)
- .replyOnce(200, { summary: {}, suites: [{ name: 'rspec' }] });
-
- testAction(
- fetchReports,
- null,
- mockedState,
- [],
- [
- {
- type: 'requestReports',
- },
- {
- payload: { data: { summary: {}, suites: [{ name: 'rspec' }] }, status: 200 },
- type: 'receiveReportsSuccess',
- },
- ],
- done,
- );
- });
- });
-
- describe('error', () => {
- beforeEach(() => {
- mock.onGet(`${TEST_HOST}/endpoint.json`).reply(500);
- });
-
- it('dispatches requestReports and receiveReportsError ', done => {
- testAction(
- fetchReports,
- null,
- mockedState,
- [],
- [
- {
- type: 'requestReports',
- },
- {
- type: 'receiveReportsError',
- },
- ],
- done,
- );
- });
- });
- });
-
- describe('receiveReportsSuccess', () => {
- it('should commit RECEIVE_REPORTS_SUCCESS mutation with 200', done => {
- testAction(
- receiveReportsSuccess,
- { data: { summary: {} }, status: 200 },
- mockedState,
- [{ type: types.RECEIVE_REPORTS_SUCCESS, payload: { summary: {} } }],
- [],
- done,
- );
- });
-
- it('should not commit RECEIVE_REPORTS_SUCCESS mutation with 204', done => {
- testAction(
- receiveReportsSuccess,
- { data: { summary: {} }, status: 204 },
- mockedState,
- [],
- [],
- done,
- );
- });
- });
-
- describe('receiveReportsError', () => {
- it('should commit RECEIVE_REPORTS_ERROR mutation', done => {
- testAction(
- receiveReportsError,
- null,
- mockedState,
- [{ type: types.RECEIVE_REPORTS_ERROR }],
- [],
- done,
- );
- });
- });
-
- describe('openModal', () => {
- it('should dispatch setModalData', done => {
- testAction(
- openModal,
- { name: 'foo' },
- mockedState,
- [],
- [{ type: 'setModalData', payload: { name: 'foo' } }],
- done,
- );
- });
- });
-
- describe('setModalData', () => {
- it('should commit SET_ISSUE_MODAL_DATA', done => {
- testAction(
- setModalData,
- { name: 'foo' },
- mockedState,
- [{ type: types.SET_ISSUE_MODAL_DATA, payload: { name: 'foo' } }],
- [],
- done,
- );
- });
- });
-});
diff --git a/spec/javascripts/reports/store/mutations_spec.js b/spec/javascripts/reports/store/mutations_spec.js
deleted file mode 100644
index 9446cd454ab..00000000000
--- a/spec/javascripts/reports/store/mutations_spec.js
+++ /dev/null
@@ -1,126 +0,0 @@
-import state from '~/reports/store/state';
-import mutations from '~/reports/store/mutations';
-import * as types from '~/reports/store/mutation_types';
-import { issue } from '../mock_data/mock_data';
-
-describe('Reports Store Mutations', () => {
- let stateCopy;
-
- beforeEach(() => {
- stateCopy = state();
- });
-
- describe('SET_ENDPOINT', () => {
- it('should set endpoint', () => {
- mutations[types.SET_ENDPOINT](stateCopy, 'endpoint.json');
-
- expect(stateCopy.endpoint).toEqual('endpoint.json');
- });
- });
-
- describe('REQUEST_REPORTS', () => {
- it('should set isLoading to true', () => {
- mutations[types.REQUEST_REPORTS](stateCopy);
-
- expect(stateCopy.isLoading).toEqual(true);
- });
- });
-
- describe('RECEIVE_REPORTS_SUCCESS', () => {
- const mockedResponse = {
- summary: {
- total: 14,
- resolved: 0,
- failed: 7,
- },
- suites: [
- {
- name: 'build:linux',
- summary: {
- total: 2,
- resolved: 0,
- failed: 1,
- },
- new_failures: [
- {
- name: 'StringHelper#concatenate when a is git and b is lab returns summary',
- execution_time: 0.0092435,
- system_output: "Failure/Error: is_expected.to eq('gitlab')",
- },
- ],
- resolved_failures: [
- {
- name: 'StringHelper#concatenate when a is git and b is lab returns summary',
- execution_time: 0.009235,
- system_output: "Failure/Error: is_expected.to eq('gitlab')",
- },
- ],
- existing_failures: [
- {
- name: 'StringHelper#concatenate when a is git and b is lab returns summary',
- execution_time: 1232.08,
- system_output: "Failure/Error: is_expected.to eq('gitlab')",
- },
- ],
- },
- ],
- };
-
- beforeEach(() => {
- mutations[types.RECEIVE_REPORTS_SUCCESS](stateCopy, mockedResponse);
- });
-
- it('should reset isLoading', () => {
- expect(stateCopy.isLoading).toEqual(false);
- });
-
- it('should reset hasError', () => {
- expect(stateCopy.hasError).toEqual(false);
- });
-
- it('should set summary counts', () => {
- expect(stateCopy.summary.total).toEqual(mockedResponse.summary.total);
- expect(stateCopy.summary.resolved).toEqual(mockedResponse.summary.resolved);
- expect(stateCopy.summary.failed).toEqual(mockedResponse.summary.failed);
- });
-
- it('should set reports', () => {
- expect(stateCopy.reports).toEqual(mockedResponse.suites);
- });
- });
-
- describe('RECEIVE_REPORTS_ERROR', () => {
- beforeEach(() => {
- mutations[types.RECEIVE_REPORTS_ERROR](stateCopy);
- });
-
- it('should reset isLoading', () => {
- expect(stateCopy.isLoading).toEqual(false);
- });
-
- it('should set hasError to true', () => {
- expect(stateCopy.hasError).toEqual(true);
- });
-
- it('should reset reports', () => {
- expect(stateCopy.reports).toEqual([]);
- });
- });
-
- describe('SET_ISSUE_MODAL_DATA', () => {
- beforeEach(() => {
- mutations[types.SET_ISSUE_MODAL_DATA](stateCopy, {
- issue,
- });
- });
-
- it('should set modal title', () => {
- expect(stateCopy.modal.title).toEqual(issue.name);
- });
-
- it('should set modal data', () => {
- expect(stateCopy.modal.data.execution_time.value).toEqual(issue.execution_time);
- expect(stateCopy.modal.data.system_output.value).toEqual(issue.system_output);
- });
- });
-});