ci: fix typecheck & store test
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import { useRecipe } from 'composables/recipe'
|
||||
import type { Recipes } from '~/types'
|
||||
import recipeData from '~/data/recipe.json'
|
||||
|
||||
const recipe = ref<Recipes>(recipeData as Recipes)
|
||||
import { useRecipeStore } from '../composables/store'
|
||||
|
||||
describe('recipe interaction', () => {
|
||||
beforeEach(() => {
|
||||
@@ -38,7 +34,6 @@ describe('recipe mode', () => {
|
||||
|
||||
it('loose mode', () => {
|
||||
const rStore = useRecipeStore()
|
||||
const { displayedRecipe } = useRecipe(recipe)
|
||||
|
||||
rStore.reset()
|
||||
rStore.addStuff('土豆')
|
||||
@@ -49,7 +44,7 @@ describe('recipe mode', () => {
|
||||
expect(rStore.selectedStuff).toStrictEqual(['土豆', '腊肠'])
|
||||
rStore.setMode('strict')
|
||||
|
||||
displayedRecipe.value.forEach((item) => {
|
||||
rStore.displayedRecipe.forEach((item) => {
|
||||
expect(item.stuff.includes('土豆') || item.stuff.includes('腊肠')).toBe(true)
|
||||
expect(item.tools?.includes('电饭煲')).toBe(true)
|
||||
})
|
||||
@@ -57,7 +52,6 @@ describe('recipe mode', () => {
|
||||
|
||||
it('strict mode', () => {
|
||||
const rStore = useRecipeStore()
|
||||
const { displayedRecipe } = useRecipe(recipe)
|
||||
|
||||
rStore.reset()
|
||||
rStore.addStuff('土豆')
|
||||
@@ -68,7 +62,7 @@ describe('recipe mode', () => {
|
||||
expect(rStore.selectedStuff).toStrictEqual(['土豆', '腊肠'])
|
||||
rStore.setMode('strict')
|
||||
|
||||
displayedRecipe.value.forEach((item) => {
|
||||
rStore.displayedRecipe.forEach((item) => {
|
||||
expect(item.stuff.includes('土豆') && item.stuff.includes('腊肠')).toBe(true)
|
||||
expect(item.tools?.includes('电饭煲')).toBe(true)
|
||||
})
|
||||
@@ -76,7 +70,6 @@ describe('recipe mode', () => {
|
||||
|
||||
it('survival mode', () => {
|
||||
const rStore = useRecipeStore()
|
||||
const { displayedRecipe } = useRecipe(recipe)
|
||||
|
||||
rStore.reset()
|
||||
rStore.addStuff('土豆')
|
||||
@@ -85,7 +78,7 @@ describe('recipe mode', () => {
|
||||
expect(rStore.selectedStuff).toStrictEqual(['土豆', '腊肠'])
|
||||
rStore.setMode('survival')
|
||||
|
||||
displayedRecipe.value.forEach((item) => {
|
||||
rStore.displayedRecipe.forEach((item) => {
|
||||
const filtered = item.stuff.every(stuff => rStore.selectedStuff.includes(stuff))
|
||||
expect(filtered).toBe(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user