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 <sivaprabug@ami.com>
Change-Id: Ibcee18bd92d97c34414ecaf2caf6af28070c5538
diff --git a/tests/unit/AppNavigation.spec.js b/tests/unit/AppNavigation.spec.js
index b37c1e4..ce410c8 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,