summaryrefslogtreecommitdiff
path: root/spec/frontend/vuex_shared/bindings_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/vuex_shared/bindings_spec.js')
-rw-r--r--spec/frontend/vuex_shared/bindings_spec.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/frontend/vuex_shared/bindings_spec.js b/spec/frontend/vuex_shared/bindings_spec.js
index 0f91a09018f..4e210143c8c 100644
--- a/spec/frontend/vuex_shared/bindings_spec.js
+++ b/spec/frontend/vuex_shared/bindings_spec.js
@@ -3,7 +3,7 @@ import { mapComputed } from '~/vuex_shared/bindings';
describe('Binding utils', () => {
describe('mapComputed', () => {
- const defaultArgs = [['baz'], 'bar', 'foo'];
+ const defaultArgs = [['baz'], 'bar', 'foo', 'qux'];
const createDummy = (mapComputedArgs = defaultArgs) => ({
computed: {
@@ -29,12 +29,18 @@ describe('Binding utils', () => {
},
};
- it('returns an object with keys equal to the first fn parameter ', () => {
+ it('returns an object with keys equal to the first fn parameter', () => {
const keyList = ['foo1', 'foo2'];
const result = mapComputed(keyList, 'foo', 'bar');
expect(Object.keys(result)).toEqual(keyList);
});
+ it('returns an object with keys equal to the first fn parameter when the root is a function', () => {
+ const keyList = ['foo1', 'foo2'];
+ const result = mapComputed(keyList, 'foo', (state) => state.bar);
+ expect(Object.keys(result)).toEqual(keyList);
+ });
+
it('returned object has set and get function', () => {
const result = mapComputed(['baz'], 'foo', 'bar');
expect(result.baz.set).toBeDefined();