diff --git a/packages/pinia/__tests__/mapHelpers.spec.ts b/packages/pinia/__tests__/mapHelpers.spec.ts index 6c532857ef..9eb9e01fc7 100644 --- a/packages/pinia/__tests__/mapHelpers.spec.ts +++ b/packages/pinia/__tests__/mapHelpers.spec.ts @@ -248,30 +248,23 @@ describe('Map Helpers', () => { it('setup store', async () => { const useSetupStore = defineStore('setup', () => { - const a = ref(true) - const n = ref(0) + const text = ref('initial') - const double = computed({ - get: () => n.value + n.value, + const textUpper = computed({ + get: () => text.value.toUpperCase(), set: (v) => { - n.value = v - }, - }) - const notA = computed({ - get: () => !a.value, - set: (v) => { - a.value = v + text.value = v }, }) - return { a, n, double, notA } + return { text, textUpper } }) await testComponent( - mapWritableState(useSetupStore, ['n', 'a', 'double', 'notA']), - `{{ n }} {{ a }} {{ double }} {{ notA }}`, - `0 true 0 false`, - 'replaced replaced replacedreplaced false' + mapWritableState(useSetupStore, ['text', 'textUpper']), + `{{ text }} {{ textUpper }}`, + `initial INITIAL`, + 'replaced REPLACED' ) }) }) diff --git a/packages/pinia/test-dts/mapHelpers.test-d.ts b/packages/pinia/test-dts/mapHelpers.test-d.ts index 38e7ce4696..1d2ee3cb8a 100644 --- a/packages/pinia/test-dts/mapHelpers.test-d.ts +++ b/packages/pinia/test-dts/mapHelpers.test-d.ts @@ -167,15 +167,11 @@ describe('mapHelpers', () => { }>(mapWritableState(useSetupStore, ['a'])) expectTypeOf<{ - a: { - get: () => 'on' | 'off' - set: (v: 'on' | 'off') => any - } writableUpper: { get: () => string set: (v: 'on' | 'off') => any } - }>(mapWritableState(useSetupStore, ['a', 'writableUpper'])) + }>(mapWritableState(useSetupStore, ['writableUpper'])) }) }) })