Commit 2e16f885 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'vs-migrate-billing-to-jest' into 'master'

Migrate ee/billings to Jest

Closes #194270

See merge request gitlab-org/gitlab!28193
parents db5cd3f3 24552217
import Vue from 'vue'; import Vue from 'vue';
import component from 'ee/billings/components/subscription_table_row.vue'; import component from 'ee/billings/components/subscription_table_row.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'helpers/vue_mount_component_helper';
import { dateInWords } from '~/lib/utils/datetime_utility'; import { dateInWords } from '~/lib/utils/datetime_utility';
describe('Subscription Table Row', () => { describe('Subscription Table Row', () => {
......
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import testAction from 'spec/helpers/vuex_action_helper'; import testAction from 'helpers/vuex_action_helper';
import state from 'ee/billings/stores/modules/subscription/state'; import state from 'ee/billings/stores/modules/subscription/state';
import * as types from 'ee/billings/stores/modules/subscription/mutation_types'; import * as types from 'ee/billings/stores/modules/subscription/mutation_types';
...@@ -22,7 +22,7 @@ describe('subscription actions', () => { ...@@ -22,7 +22,7 @@ describe('subscription actions', () => {
}); });
describe('setNamespaceId', () => { describe('setNamespaceId', () => {
it('should commit the correct mutuation', done => { it('should commit the correct mutuation', () => {
const namespaceId = 1; const namespaceId = 1;
testAction( testAction(
...@@ -36,7 +36,6 @@ describe('subscription actions', () => { ...@@ -36,7 +36,6 @@ describe('subscription actions', () => {
}, },
], ],
[], [],
done,
); );
}); });
}); });
...@@ -54,7 +53,7 @@ describe('subscription actions', () => { ...@@ -54,7 +53,7 @@ describe('subscription actions', () => {
.replyOnce(200, mockDataSubscription.gold); .replyOnce(200, mockDataSubscription.gold);
}); });
it('should dispatch the request and success actions', done => { it('should dispatch the request and success actions', () => {
testAction( testAction(
actions.fetchSubscription, actions.fetchSubscription,
{}, {},
...@@ -67,7 +66,6 @@ describe('subscription actions', () => { ...@@ -67,7 +66,6 @@ describe('subscription actions', () => {
payload: mockDataSubscription.gold, payload: mockDataSubscription.gold,
}, },
], ],
done,
); );
}); });
}); });
...@@ -77,34 +75,32 @@ describe('subscription actions', () => { ...@@ -77,34 +75,32 @@ describe('subscription actions', () => {
mock.onGet(/\/api\/v4\/namespaces\/\d+\/gitlab_subscription(.*)$/).replyOnce(404, {}); mock.onGet(/\/api\/v4\/namespaces\/\d+\/gitlab_subscription(.*)$/).replyOnce(404, {});
}); });
it('should dispatch the request and error actions', done => { it('should dispatch the request and error actions', () => {
testAction( testAction(
actions.fetchSubscription, actions.fetchSubscription,
{}, {},
mockedState, mockedState,
[], [],
[{ type: 'requestSubscription' }, { type: 'receiveSubscriptionError' }], [{ type: 'requestSubscription' }, { type: 'receiveSubscriptionError' }],
done,
); );
}); });
}); });
}); });
describe('requestSubscription', () => { describe('requestSubscription', () => {
it('should commit the request mutation', done => { it('should commit the request mutation', () => {
testAction( testAction(
actions.requestSubscription, actions.requestSubscription,
{}, {},
state, state,
[{ type: types.REQUEST_SUBSCRIPTION }], [{ type: types.REQUEST_SUBSCRIPTION }],
[], [],
done,
); );
}); });
}); });
describe('receiveSubscriptionSuccess', () => { describe('receiveSubscriptionSuccess', () => {
it('should commit the success mutation', done => { it('should commit the success mutation', () => {
testAction( testAction(
actions.receiveSubscriptionSuccess, actions.receiveSubscriptionSuccess,
mockDataSubscription.gold, mockDataSubscription.gold,
...@@ -116,20 +112,18 @@ describe('subscription actions', () => { ...@@ -116,20 +112,18 @@ describe('subscription actions', () => {
}, },
], ],
[], [],
done,
); );
}); });
}); });
describe('receiveSubscriptionError', () => { describe('receiveSubscriptionError', () => {
it('should commit the error mutation', done => { it('should commit the error mutation', () => {
testAction( testAction(
actions.receiveSubscriptionError, actions.receiveSubscriptionError,
{}, {},
mockedState, mockedState,
[{ type: types.RECEIVE_SUBSCRIPTION_ERROR }], [{ type: types.RECEIVE_SUBSCRIPTION_ERROR }],
[], [],
done,
); );
}); });
}); });
......
import mockData from '../../frontend/billings/mock_data';
export default mockData;
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