diff options
author | Damian Celico <damianx.celico@intel.com> | 2022-11-24 04:00:53 +0300 |
---|---|---|
committer | Kiran Kumar Ballapalli <kirankumarb@ami.com> | 2023-03-27 19:39:34 +0300 |
commit | aeb19816e67f6d3ffb1b37c95d813a25b8be1d7b (patch) | |
tree | 0b760854f8adc45a3e909a3b1ccd88655a139705 /tests | |
parent | 568b8a93af49d35891f042f73add850cfa651308 (diff) | |
download | webui-vue-aeb19816e67f6d3ffb1b37c95d813a25b8be1d7b.tar.xz |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/AppNavigation.spec.js | 13 |
1 files changed, 11 insertions, 2 deletions
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, |