Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/packages_and_registries/infrastructure_registry/components/details/store/mutations_spec.js')
-rw-r--r--spec/frontend/packages_and_registries/infrastructure_registry/components/details/store/mutations_spec.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/details/store/mutations_spec.js b/spec/frontend/packages_and_registries/infrastructure_registry/components/details/store/mutations_spec.js
new file mode 100644
index 00000000000..6efefea4a14
--- /dev/null
+++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/details/store/mutations_spec.js
@@ -0,0 +1,40 @@
+import * as types from '~/packages_and_registries/infrastructure_registry/details/store/mutation_types';
+import mutations from '~/packages_and_registries/infrastructure_registry/details/store/mutations';
+import { npmPackage as packageEntity } from 'jest/packages/mock_data';
+
+describe('Mutations package details Store', () => {
+ let mockState;
+
+ beforeEach(() => {
+ mockState = {
+ packageEntity,
+ };
+ });
+
+ describe('SET_LOADING', () => {
+ it('should set loading', () => {
+ mutations[types.SET_LOADING](mockState, true);
+
+ expect(mockState.isLoading).toEqual(true);
+ });
+ });
+
+ describe('SET_PACKAGE_VERSIONS', () => {
+ it('should set the package entity versions', () => {
+ const fakeVersions = [1, 2, 3];
+
+ mutations[types.SET_PACKAGE_VERSIONS](mockState, fakeVersions);
+
+ expect(mockState.packageEntity.versions).toEqual(fakeVersions);
+ });
+ });
+ describe('UPDATE_PACKAGE_FILES', () => {
+ it('should update the packageFiles', () => {
+ const files = [1, 2, 3];
+
+ mutations[types.UPDATE_PACKAGE_FILES](mockState, files);
+
+ expect(mockState.packageFiles).toEqual(files);
+ });
+ });
+});