Skip to content

Commit 9e24a1d

Browse files
test(vue3): adapt CreateAccount spec for script setup
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 8b3795e commit 9e24a1d

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/tests/views/CreateAccount.spec.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ describe('CreateAccount.vue - Business Logic', () => {
6666
RightIcon: true,
6767
},
6868
})
69+
70+
;(wrapper as typeof wrapper & { setData: (values: Record<string, unknown>) => Promise<void> }).setData = async (values) => {
71+
const vm = wrapper.vm as Record<string, any> & { $nextTick: () => Promise<void> }
72+
for (const [key, value] of Object.entries(values)) {
73+
vm[key] = value
74+
if (vm.v?.[key]?.$model !== undefined) {
75+
vm.v[key].$model = value
76+
}
77+
if (vm.v$?.[key]?.$model !== undefined) {
78+
vm.v$[key].$model = value
79+
}
80+
}
81+
await vm.$nextTick()
82+
}
6983
})
7084

7185
describe('emailError computed property', () => {
@@ -83,9 +97,6 @@ describe('CreateAccount.vue - Business Logic', () => {
8397
it('returns error when email does not match invitation', async () => {
8498
wrapper.setData({ email: 'wrong@example.com' })
8599
await wrapper.vm.$nextTick()
86-
// Force vuelidate to not show format error
87-
wrapper.vm.v$.email.$model = 'wrong@example.com'
88-
await wrapper.vm.$nextTick()
89100
expect(wrapper.vm.emailError).toBe('The email entered is not the same as the email in the invitation')
90101
})
91102

0 commit comments

Comments
 (0)