From 0f47843f3f5357fbc34ebe49ac94ad86e74459d7 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 14 Mar 2024 12:06:35 +0100 Subject: [PATCH] feat(frontend): add pinia testing --- package-lock.json | 42 +++++++++++++++++++++++++++++++++++ package.json | 1 + scripts/tests/plugin.pinia.ts | 5 ++--- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 70e3299..1747665 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "devDependencies": { "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0", "@intlify/eslint-plugin-vue-i18n": "^2.0.0", + "@pinia/testing": "^0.1.3", "@storybook/addon-essentials": "^7.6.17", "@storybook/addon-interactions": "^7.6.17", "@storybook/addon-links": "^7.6.17", @@ -4377,6 +4378,47 @@ "integrity": "sha512-XuySG1E38YScSJoMlqovLru4KTUNSjgVTIjyh7qMX6aNN5HY5Ct5LhRJdxO79JtTzKfzV/bnWpz+zquYrISsvw==", "dev": true }, + "node_modules/@pinia/testing": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@pinia/testing/-/testing-0.1.3.tgz", + "integrity": "sha512-D2Ds2s69kKFaRf2KCcP1NhNZEg5+we59aRyQalwRm7ygWfLM25nDH66267U3hNvRUOTx8ofL24GzodZkOmB5xw==", + "dev": true, + "dependencies": { + "vue-demi": ">=0.14.5" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "pinia": ">=2.1.5" + } + }, + "node_modules/@pinia/testing/node_modules/vue-demi": { + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.7.tgz", + "integrity": "sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", diff --git a/package.json b/package.json index f5442e6..a606f71 100644 --- a/package.json +++ b/package.json @@ -89,6 +89,7 @@ "devDependencies": { "@eslint-community/eslint-plugin-eslint-comments": "^4.1.0", "@intlify/eslint-plugin-vue-i18n": "^2.0.0", + "@pinia/testing": "^0.1.3", "@storybook/addon-essentials": "^7.6.17", "@storybook/addon-interactions": "^7.6.17", "@storybook/addon-links": "^7.6.17", diff --git a/scripts/tests/plugin.pinia.ts b/scripts/tests/plugin.pinia.ts index 4d0bb09..bc3bfc4 100644 --- a/scripts/tests/plugin.pinia.ts +++ b/scripts/tests/plugin.pinia.ts @@ -1,5 +1,4 @@ +import { createTestingPinia } from '@pinia/testing' import { config } from '@vue/test-utils' -import pinia from '#plugins/pinia' - -config.global.plugins.push(pinia) +config.global.plugins.push(createTestingPinia())