Skip to content

Commit

Permalink
Await test
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-barraza committed Mar 3, 2025
1 parent 9b73e52 commit 5282a2d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions auth-web/tests/unit/components/ProductPayment.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LoginSource, Permission } from '@/util/constants'
import { createLocalVue, mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import ProductPackage from '@/components/auth/account-settings/product/ProductPayment.vue'

Check failure on line 4 in auth-web/tests/unit/components/ProductPayment.spec.ts

View workflow job for this annotation

GitHub Actions / account-ui-ci / linting-npm (20.5.1)

Imports should be sorted alphabetically
import VueRouter from 'vue-router'
import Vuetify from 'vuetify'
Expand Down Expand Up @@ -87,15 +88,18 @@ describe('Account settings ProductPackage.vue', () => {

it('handles modal dialog add product correctly', async () => {
const orgStore = useOrgStore()

await wrapper.vm.$nextTick()

orgStore.addOrgProducts = vi.fn().mockResolvedValue({})

wrapper.vm.$refs.confirmDialog = { open: vi.fn() }

orgStore.currentSelectedProducts = [{ code: 'TEST_PRODUCT' }]
wrapper.vm.addProductOnAccountAdmin = true
const mockOpen = vi.fn()
wrapper.vm.$refs.confirmDialog.open = mockOpen


await wrapper.vm.submitProductRequest()
expect(mockOpen).toHaveBeenCalled()
await flushPromises()

expect(wrapper.vm.$refs.confirmDialog.open).toHaveBeenCalled()
expect(wrapper.vm.dialogTitle).toBe('Product Added')
expect(wrapper.vm.dialogText).toBe('Your account now has access to the selected product.')
expect(wrapper.vm.dialogError).toBe(false)
Expand Down

0 comments on commit 5282a2d

Please # to comment.