Skip to content

Commit 70a9d2c

Browse files
fixed test
1 parent c779667 commit 70a9d2c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/unit/pinia/$dispose.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { useRegle } from '@regle/core';
22
import { required } from '@regle/rules';
33
import { flushPromises, mount } from '@vue/test-utils';
44
import { createPinia, defineStore, setActivePinia, skipHydrate, storeToRefs } from 'pinia';
5-
import { defineComponent, nextTick, ref } from 'vue';
5+
import { version as piniaVersion } from 'pinia/package.json';
6+
import { defineComponent, nextTick, ref, version } from 'vue';
7+
import { isVueSuperiorOrEqualTo3dotFive } from '../../../packages/core/src/utils';
68

7-
describe('$dispose', () => {
9+
describe.runIf(isVueSuperiorOrEqualTo3dotFive)('$dispose', () => {
810
const useStore = defineStore('store', () => {
911
const { r$ } = useRegle(
1012
{ name: 'Hello', nested: { child: '' }, collection: [{ name: '' }] },
@@ -70,7 +72,12 @@ describe('$dispose', () => {
7072
if (element.find('.compoA').exists()) {
7173
element.find('.compoA-input').setValue('Boo');
7274
}
73-
await nextTick();
75+
76+
await element.vm.$nextTick();
77+
78+
if (element.find('.compoA').exists()) {
79+
expect(element.find('input').element.value).toBe('Boo');
80+
}
7481

7582
if (element.find('.compoA').exists()) {
7683
expect(element.find('.compoA').text()).toBe('Boo');

tests/unit/test.config.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import { version } from 'vue';
2+
import { version as piniaVersion } from 'pinia/package.json';
23

34
describe('ensure test is correctly configured', () => {
45
it('should have correct vue version', () => {
56
if (process.env.VUE_VERSION === '3.4') {
67
// To be sure the version switching works
78
expect(version).toBe('3.4.38');
9+
expect(piniaVersion).toBe('2.2.5');
810
} else {
911
// To be sure the version switching works
1012
expect(version).toBe('3.5.16');
13+
expect(piniaVersion).toBe('3.0.3');
1114
}
1215
});
1316
});

0 commit comments

Comments
 (0)