From aeb19816e67f6d3ffb1b37c95d813a25b8be1d7b Mon Sep 17 00:00:00 2001 From: Damian Celico Date: Thu, 24 Nov 2022 02:00:53 +0100 Subject: Added route restrictions based on user privilege This commit allows us to add 'exclusiveToRoles' field to route config files, with the list of roles that can access this resource, if needed. In this case, only Administrator can access Virtual-Media page and SOL console, and it is blocked for other users. Signed-off-by: Sivaprabu Ganesan Change-Id: Ibcee18bd92d97c34414ecaf2caf6af28070c5538 --- tests/unit/AppNavigation.spec.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/unit/AppNavigation.spec.js b/tests/unit/AppNavigation.spec.js index b37c1e4c..ce410c8d 100644 --- a/tests/unit/AppNavigation.spec.js +++ b/tests/unit/AppNavigation.spec.js @@ -1,16 +1,25 @@ -import { mount, createWrapper } from '@vue/test-utils'; +import { mount, createLocalVue, createWrapper } from '@vue/test-utils'; import AppNavigation from '@/components/AppNavigation'; import Vue from 'vue'; +import Vuex from 'vuex'; import VueRouter from 'vue-router'; import { BootstrapVue } from 'bootstrap-vue'; +const localVue = createLocalVue(); +localVue.use(Vuex); + describe('AppNavigation.vue', () => { let wrapper; + const router = new VueRouter(); + const actions = { + 'global/userPrivilege': jest.fn(), + }; + const store = new Vuex.Store({ actions }); Vue.use(BootstrapVue); Vue.use(VueRouter); - const router = new VueRouter(); wrapper = mount(AppNavigation, { + store, router, mocks: { $t: (key) => key, -- cgit v1.2.3