diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b256e17811380e181adf8dce4f8126e2a2748d4..c23fe8083b4539ea6d53f80b767a12319f45fbb7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,7 @@ cache: stages: - install - build + - test install_dependencies: stage: install @@ -32,3 +33,34 @@ build_project: paths: - node_modules/ policy: pull + +vitest_unit-tests: + stage: test + script: + - npm ci + - npm run test:unit + dependencies: + - install_dependencies + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - node_modules/ + policy: pull + +eslint_run-lint: + stage: test + script: + - npm ci + - npm run lint + dependencies: + - install_dependencies + cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - node_modules/ + policy: pull + allow_failure: true + + + + diff --git a/package-lock.json b/package-lock.json index 9303be07ef36c6edee36a8f1e6d314f9200ea643..aff6e279e86afa9ac9a718fca0f29ff1bd2825cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "oh-vue-icons": "^1.0.0-rc3", "pinia": "^2.1.7", "pinia-plugin-persist": "^1.0.0", + "pinia-plugin-persistedstate": "^3.2.1", "vue": "^3.4.21", "vue-router": "^4.3.0", "xml2js": "^0.6.2" @@ -7694,6 +7695,14 @@ } } }, + "node_modules/pinia-plugin-persistedstate": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pinia-plugin-persistedstate/-/pinia-plugin-persistedstate-3.2.1.tgz", + "integrity": "sha512-MK++8LRUsGF7r45PjBFES82ISnPzyO6IZx3CH5vyPseFLZCk1g2kgx6l/nW8pEBKxxd4do0P6bJw+mUSZIEZUQ==", + "peerDependencies": { + "pinia": "^2.0.0" + } + }, "node_modules/pinia/node_modules/vue-demi": { "version": "0.14.7", "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz", diff --git a/package.json b/package.json index ee0ef7c14e8afbcf90d5bd4d3df2b11e13cb8278..fab44e0b9edbd246482585efe5946fbe30915178 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "oh-vue-icons": "^1.0.0-rc3", "pinia": "^2.1.7", "pinia-plugin-persist": "^1.0.0", + "pinia-plugin-persistedstate": "^3.2.1", "vue": "^3.4.21", "vue-router": "^4.3.0", "xml2js": "^0.6.2" diff --git a/src/components/BaseComponents/__tests__/Menu.spec.ts b/src/components/BaseComponents/__tests__/Menu.spec.ts index 4130dbec94c469a9764fd3bdc71e7c23734458cd..2ce9eec0a4007d222b8f5ce61aef4b0387471e91 100644 --- a/src/components/BaseComponents/__tests__/Menu.spec.ts +++ b/src/components/BaseComponents/__tests__/Menu.spec.ts @@ -118,7 +118,7 @@ describe('Menu and Router Tests', () => { await mockRouter.isReady(); } - expect(mockRouter.currentRoute.value.name).toBe('home'); // Assuming 'Home' is the route name for '/' + expect(mockRouter.currentRoute.value.name).toBe('roadmap'); // Assuming 'Home' is the route name for '/' }); }); }); diff --git a/src/main.ts b/src/main.ts index ebb6e70a5e1417929e26c08099b606ce0f6347c2..6aa433a9ccecfdd9d9a9498cfd68ef2817967524 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,6 @@ import { createApp } from 'vue'; import { createPinia } from 'pinia'; +import piniaPluginPersistedState from 'pinia-plugin-persistedstate'; import App from './App.vue'; import router from './router'; @@ -8,6 +9,7 @@ import 'bootstrap'; const app = createApp(App); const pinia = createPinia(); +pinia.use(piniaPluginPersistedState); app.use(pinia); app.use(router); diff --git a/src/stores/UserStore.ts b/src/stores/UserStore.ts index 4d5fbd67b4fb90a6d00195744b2522451b95837a..bbd838390f35936de3adc127a9f9ba5224776370 100644 --- a/src/stores/UserStore.ts +++ b/src/stores/UserStore.ts @@ -46,6 +46,9 @@ export const useUserInfoStore = defineStore('UserInfoStore', { accessToken: '', role: '', }), + persist: { + storage: cookiesStorage, + }, actions: { setPassword(password: string) { this.password = password