test: fix unit test temp

This commit is contained in:
YunYouJun
2022-06-27 09:38:18 +08:00
parent 0331d0fc86
commit 6bf89ef0a6
7 changed files with 74 additions and 27 deletions

View File

@@ -10,6 +10,7 @@ const namespace = 'cook'
export type SearchMode = 'survival' | 'loose' | 'strict'
export const useRecipeStore = defineStore('recipe', () => {
// can not exported
const curStuff = useStorage(`${namespace}:stuff`, new Set<string>())
// const curTools = ref(new Set<string>())
const curTool = useStorage(`${namespace}:tool`, '')
@@ -23,7 +24,6 @@ export const useRecipeStore = defineStore('recipe', () => {
function toggleStuff(name: string) {
if (!curStuff.value)
return
if (curStuff.value.has(name))
curStuff.value.delete(name)
else
@@ -54,8 +54,11 @@ export const useRecipeStore = defineStore('recipe', () => {
curTool.value = ''
}
function addStuff(name: string) {
curStuff.value.add(name)
}
return {
curStuff,
curTool,
curMode,
selectedStuff,
@@ -64,6 +67,8 @@ export const useRecipeStore = defineStore('recipe', () => {
toggleTools,
reset,
setMode,
addStuff,
}
})