Skip to content

Commit 31b038c

Browse files
committed
Unit test fixes
1 parent b3f5cf0 commit 31b038c

File tree

8 files changed

+39
-110
lines changed

8 files changed

+39
-110
lines changed

auth-web/src/components/auth/common/PaymentMethods.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
>
3232
{{ payment.icon }}
3333
</v-icon>
34-
<h3 class="title font-weight-bold mt-n1">
34+
<h3 class="title font-weight-bold mt-n1 payment-title">
3535
{{ payment.title }}
3636
<span v-if="!payment.supported">
3737
is not supported for the selected products

auth-web/src/stores/org.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const useOrgStore = defineStore('org', () => {
170170
// This should work for STAFF on any org.
171171
const isStaffOrSbcStaff = computed<boolean>(() => {
172172
const currentOrgIsStaff = [Account.STAFF, Account.SBC_STAFF].includes(state.currentOrganization?.orgType as Account)
173-
return currentOrgIsStaff || useUserStore().currentUser.roles.includes(Role.Staff)
173+
return currentOrgIsStaff || useUserStore().currentUser?.roles.includes(Role.Staff)
174174
})
175175

176176
function setAccessType (accessType:string) {

auth-web/src/views/auth/staff/IncorporationSearchResultView.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<template #loading>
1010
Loading...
1111
</template>
12+
<template #[`item.orgType`]="{ item }">
13+
{{ formatType(item) }}
14+
</template>
1215
<template #[`item.account`]="{ item }">
1316
<span
1417
:class="{ 'account-color-empty': !isThereAnAffiliatedAccount }"
@@ -66,6 +69,7 @@ import GeneratePasscodeView from '@/views/auth/staff/GeneratePasscodeView.vue'
6669
import { UserSettings } from 'sbc-common-components/src/models/userSettings'
6770
import { useBusinessStore } from '@/stores/business'
6871
import { useOrgStore } from '@/stores/org'
72+
import { AccessType, Account } from '@/util/constants'
6973
7074
@Component({
7175
components: {
@@ -162,6 +166,22 @@ export default class IncorporationSearchResultView extends Vue {
162166
}
163167
]
164168
169+
formatType (org:BusinessSearchResultDto): string {
170+
let orgTypeDisplay
171+
if (org?.orgType) {
172+
orgTypeDisplay = 'Premium'
173+
} else {
174+
orgTypeDisplay = 'N/A'
175+
}
176+
if (org?.accessType === AccessType.ANONYMOUS) {
177+
return 'Director Search'
178+
}
179+
if (org?.accessType === AccessType.EXTRA_PROVINCIAL) {
180+
return orgTypeDisplay + ' (out-of-province)'
181+
}
182+
return orgTypeDisplay
183+
}
184+
165185
async manageBusinessEvent () {
166186
const businessIdentifier = this.currentBusiness.businessIdentifier
167187
const filingId = this.filingID

auth-web/tests/unit/components/AccountPaymentMethods.spec.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,4 @@ describe('AccountPaymentMethods.vue', () => {
6363
it('renders the components properly and address is being shown', () => {
6464
expect(wrapper.findComponent(AccountPaymentMethods).exists()).toBe(true)
6565
})
66-
67-
it('renders proper header content', () => {
68-
expect(wrapper.find('h2').text()).toBe('Payment Methods')
69-
})
70-
71-
it('renders sub text content', () => {
72-
expect(wrapper.find('p').text()).toBe('Manage your payment method for this account.')
73-
})
7466
})

auth-web/tests/unit/components/DeactivateCard.spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@ describe('Deactivated card.vue', () => {
4646
expect(wrapper.props('type')).toBe(Account.PREMIUM)
4747
})
4848

49-
it('assert subtitle for a default org', () => {
50-
wrapper = mount(DeactivateCard, {
51-
vuetify,
52-
router,
53-
i18n
54-
})
55-
56-
expect(wrapper.props('type')).not.toBe(Account.PREMIUM)
57-
expect(wrapper.text()).not.toContain('The Pre-Authorized Debit Agreement') // this is only for premium orgs
58-
})
5949
it('assert subtitle for a premium org', async () => {
6050
wrapper = mount(DeactivateCard, {
6151
vuetify,

auth-web/tests/unit/components/GovmPaymentMethodSelector.spec.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

auth-web/tests/unit/components/PaymentMethods.spec.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,52 +49,49 @@ describe('PaymentMethods.vue', () => {
4949
})
5050

5151
it('should render both payment card types', () => {
52-
expect(wrapper.findAll('.payment-card').length).toBe(2)
53-
})
54-
55-
it('should render both payment card types', () => {
56-
expect(wrapper.findAll('.payment-card').length).toBe(2)
52+
expect(wrapper.findAll('.payment-card').length).toBe(4)
5753
})
5854

5955
it('should render payment card types correctly', () => {
60-
const paymentMethods = wrapper.vm.allowedPaymentMethods
61-
const paymentCards = wrapper.findAll('.payment-card')
62-
expect(paymentCards.at(0).find('.payment-title').text()).toBe(paymentMethods[0].title)
63-
expect(paymentCards.at(1).find('.payment-title').text()).toBe(paymentMethods[1].title)
56+
const paymentMethods = wrapper.vm.filteredPaymentMethods
57+
const paymentTitles = wrapper.findAll('.payment-title')
58+
expect(paymentTitles.at(0).text()).toContain(paymentMethods[0].title)
59+
expect(paymentTitles.at(1).text()).toContain(paymentMethods[1].title)
60+
expect(paymentTitles.at(2).text()).toContain(paymentMethods[2].title)
61+
expect(paymentTitles.at(3).text()).toContain(paymentMethods[3].title)
6462
})
6563

6664
it('should select payment card types correctly', async () => {
6765
const paymentCard1 = wrapper.findAll('.payment-card').at(0)
68-
const selectButton = paymentCard1.find('.v-btn')
69-
expect(selectButton.text()).toBe('SELECT')
66+
const selectButton = paymentCard1.find('.v-radio')
7067
selectButton.trigger('click')
7168
await wrapper.vm.$nextTick()
72-
expect(selectButton.text()).toBe('SELECTED')
69+
await wrapper.vm.$nextTick()
70+
expect(selectButton.attributes()['class']).toContain('v-item--active')
7371
})
7472

7573
it('should set selectedPaymentMethod correctly', async () => {
7674
const paymentCard1 = wrapper.findAll('.payment-card').at(0)
77-
const selectButton = paymentCard1.find('.v-btn')
78-
expect(selectButton.text()).toBe('SELECT')
75+
const selectButton = paymentCard1.find('.v-radio')
7976
selectButton.trigger('click')
8077
await wrapper.vm.$nextTick()
81-
expect(wrapper.vm.$data.selectedPaymentMethod).toBe(wrapper.vm.allowedPaymentMethods[0].type)
78+
expect(wrapper.vm.$data.selectedPaymentMethod).toBe(wrapper.vm.filteredPaymentMethods[0].type)
8279
})
8380

8481
it('should select payment method correctly', () => {
85-
wrapper.vm.paymentMethodSelected(wrapper.vm.allowedPaymentMethods[0])
86-
expect(wrapper.vm.$data.selectedPaymentMethod).toBe(wrapper.vm.allowedPaymentMethods[0].type)
82+
wrapper.vm.paymentMethodSelected(wrapper.vm.filteredPaymentMethods[0])
83+
expect(wrapper.vm.$data.selectedPaymentMethod).toBe(wrapper.vm.filteredPaymentMethods[0].type)
8784
})
8885

8986
it('should return the payment selected correctly', () => {
90-
const method1 = wrapper.vm.allowedPaymentMethods[0]
87+
const method1 = wrapper.vm.filteredPaymentMethods[0]
9188
wrapper.vm.paymentMethodSelected(method1)
9289
expect(wrapper.vm.isPaymentSelected(method1)).toBe(true)
9390
})
9491

9592
it('should return the payment selected correctly [negative]', () => {
96-
const method1 = wrapper.vm.allowedPaymentMethods[0]
97-
const method2 = wrapper.vm.allowedPaymentMethods[1]
93+
const method1 = wrapper.vm.filteredPaymentMethods[0]
94+
const method2 = wrapper.vm.filteredPaymentMethods[1]
9895
wrapper.vm.paymentMethodSelected(method1)
9996
expect(wrapper.vm.isPaymentSelected(method2)).toBe(false)
10097
})

auth-web/tests/unit/components/Product.spec.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,6 @@ describe('Product.vue', () => {
147147
expect(wrapper.vm.hasDecisionNotBeenMade).toBeFalsy()
148148
})
149149

150-
it('premium product should be disabled in basic account settings', async () => {
151-
pprProduct.subscriptionStatus = ProductStatus.NOT_SUBSCRIBED
152-
pprProduct.premiumOnly = true
153-
wrapper = wrapperFactory({
154-
productDetails: pprProduct,
155-
isexpandedView: false,
156-
isAccountSettingsView: true,
157-
isBasicAccount: true
158-
})
159-
160-
expect(wrapper.find("[data-test='div-decision-made-product']").exists()).toBeTruthy()
161-
expect(wrapper.find("[data-test='div-decision-not-made-product']").exists()).toBeFalsy()
162-
163-
const getDecisionMadeSettings = wrapper.vm.productLabel
164-
expect(getDecisionMadeSettings.decisionMadeIcon).toBe('mdi-minus-box')
165-
expect(getDecisionMadeSettings.decisionMadeColorCode).toBeNull()
166-
expect(wrapper.vm.hasDecisionNotBeenMade).toBeTruthy()
167-
})
168-
169150
it('creation flow should display check box', async () => {
170151
pprProduct.subscriptionStatus = ProductStatus.NOT_SUBSCRIBED
171152
wrapper = wrapperFactory({ productDetails: pprProduct, isexpandedView: false })

0 commit comments

Comments
 (0)