debian-mirror-gitlab/spec/frontend/clusters/stores/clusters_store_spec.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-03-11 19:13:27 +05:30
import ClustersStore from '~/clusters/stores/clusters_store';
2018-03-17 18:26:18 +05:30
import { CLUSTERS_MOCK_DATA } from '../services/mock_data';
describe('Clusters Store', () => {
let store;
beforeEach(() => {
store = new ClustersStore();
});
describe('updateStatus', () => {
it('should store new status', () => {
expect(store.state.status).toEqual(null);
const newStatus = 'errored';
store.updateStatus(newStatus);
expect(store.state.status).toEqual(newStatus);
});
});
describe('updateStatusReason', () => {
it('should store new reason', () => {
expect(store.state.statusReason).toEqual(null);
const newReason = 'Something went wrong!';
store.updateStatusReason(newReason);
expect(store.state.statusReason).toEqual(newReason);
});
});
describe('updateStateFromServer', () => {
it('should store new polling data from server', () => {
2018-12-13 13:39:08 +05:30
const mockResponseData =
CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/1/status.json'].data;
2018-03-17 18:26:18 +05:30
store.updateStateFromServer(mockResponseData);
expect(store.state).toEqual({
helpPath: null,
2019-12-04 20:38:33 +05:30
environmentsHelpPath: null,
clustersHelpPath: null,
deployBoardsHelpPath: null,
2018-03-17 18:26:18 +05:30
status: mockResponseData.status,
statusReason: mockResponseData.status_reason,
2019-12-21 20:55:43 +05:30
providerType: null,
2019-02-15 15:39:39 +05:30
rbac: false,
2019-12-04 20:38:33 +05:30
environments: [],
fetchingEnvironments: false,
2018-03-17 18:26:18 +05:30
});
});
});
});