Skip to content

Commit

Permalink
- updated browserslist
Browse files Browse the repository at this point in the history
- unit tests (WIP)
  • Loading branch information
Severin Beauvais committed Jul 4, 2024
1 parent 483b672 commit 78666ad
Show file tree
Hide file tree
Showing 5 changed files with 286 additions and 7 deletions.
12 changes: 6 additions & 6 deletions auth-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auth-web/src/components/pay/CompletePaymentDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default defineComponent({
}
},
emits: ['step-forward'],
setup (props, {root}) {
setup (props, { root }) {
const orgStore = useOrgStore()
const paymentTypes = PaymentTypes
const state = reactive({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { Wrapper, createLocalVue, mount } from '@vue/test-utils'
import BusinessService from '@/services/business.services'
import ContinuationAuthorizationReview from '@/views/auth/staff/ContinuationAuthorizationReview.vue'
import Vue from 'vue'
import Vuetify from 'vuetify'
import flushPromises from 'flush-promises'

Vue.use(Vuetify)

const localVue = createLocalVue()
const vuetify = new Vuetify({})

describe('ExtraprovincialRegistrationBc component', () => {
let wrapper: Wrapper<ContinuationAuthorizationReview>

beforeAll(async () => {
// mock "fetchContinuationReview" business service
vi.spyOn(BusinessService, 'fetchContinuationReview').mockImplementation((): any => {
return Promise.resolve({
review: {},
results: {},
filing: {
continuationIn: {
mode: 'EXPRO'
}
}
})
})

wrapper = mount(ContinuationAuthorizationReview, {
localVue,
propsData: { reviewId: 123 },
stubs: {
ExtraprovincialRegistrationBc: true,
HomeJurisdictionInformation: true
},
vuetify
})

// wait for things to stabilize
await flushPromises()
})

afterAll(() => {
wrapper.destroy()
})

it('rendered the component', () => {
expect(wrapper.vm).toBeTruthy()
expect(wrapper.find('#continuation-authorization-review').exists()).toBe(true)
})

it('got the prop', () => {
expect(wrapper.vm.reviewId).toBe(123)
})

it('fetched the continuation review object', () => {
expect(wrapper.vm.continuationReview).toBeTruthy()
})

it('computed "is expro" to be True', () => {
expect(wrapper.vm.isExpro).toBe(true)
})

it('rendered the error dialog', () => {
expect(wrapper.find('.notify-dialog').exists()).toBe(true)
})

it('rendered the container header', () => {
expect(wrapper.find('.view-header').exists()).toBe(true)
expect(wrapper.find('h1').text()).toBe('Continuation Authorization Review')
})

it('rendered the first v-card', () => {
const vcard1 = wrapper.find('#extraprovincial-registration-bc-vcard')
expect(vcard1.exists()).toBe(true)
expect(vcard1.find('header').text()).toBe('Extraprovincial Registration in B.C.')
expect(vcard1.find('extraprovincialregistrationbc-stub').exists()).toBe(true)
})

it('rendered the second v-card', () => {
const vcard2 = wrapper.find('#home-jurisdiction-information-vcard')
expect(vcard2.exists()).toBe(true)
expect(vcard2.find('header').text()).toBe('Home Jurisdiction Information')
expect(vcard2.find('homejurisdictioninformation-stub').exists()).toBe(true)
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { Wrapper, createLocalVue, mount } from '@vue/test-utils'
import ExtraprovincialRegistrationBc from '@/components/auth/staff/continuation-in/ExtraprovincialRegistrationBc.vue'
import Vue from 'vue'
import Vuetify from 'vuetify'
import flushPromises from 'flush-promises'

Vue.use(Vuetify)

const localVue = createLocalVue()
const vuetify = new Vuetify({})

const continuationReview = {
filing: {
continuationIn: {
business: {
foundingDate: '2001-05-03T07:00:00.000+00:00',
identifier: 'A0054444',
legalName: 'FIRST AWIQ SHOPPING CENTRES BC LIMITED'
}
}
}
}

describe('ExtraprovincialRegistrationBc component', () => {
let wrapper: Wrapper<ExtraprovincialRegistrationBc>

beforeAll(async () => {
wrapper = mount(ExtraprovincialRegistrationBc, {
localVue,
propsData: { continuationReview },
vuetify
})

// wait for things to stabilize
await flushPromises()

vi.resetModules()
vi.clearAllMocks()
})

afterAll(() => {
wrapper.destroy()
})

it('rendered the component', () => {
expect(wrapper.vm).toBeTruthy()
expect(wrapper.find('#extraprovincial-registration-bc').exists()).toBe(true)
})

it('got the prop', () => {
expect(wrapper.vm.continuationReview).toBeTruthy()
})

it('computed "identifier"', () => {
expect(wrapper.vm.identifier).toBe('A0054444')
})

it('computed "legalName"', () => {
expect(wrapper.vm.legalName).toBe('FIRST AWIQ SHOPPING CENTRES BC LIMITED')
})

it('computed "foundingDate"', () => {
expect(wrapper.vm.foundingDate).toBe('May 3, 2001')
})

// it('rendered the container header', () => {
// expect(wrapper.find('.view-header').exists()).toBe(true)
// expect(wrapper.find('h1').text()).toBe('Continuation Authorization Review')
// })

// it('rendered the first v-card', () => {
// const vcard1 = wrapper.find('#extraprovincial-registration-bc-vcard')
// expect(vcard1.exists()).toBe(true)
// expect(vcard1.find('header').text()).toBe('Extraprovincial Registration in B.C.')
// expect(vcard1.find('extraprovincialregistrationbc-stub').exists()).toBe(true)
// })
})
115 changes: 115 additions & 0 deletions auth-web/tests/unit/components/HomeJurisdictionInformation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import { Wrapper, createLocalVue, mount } from '@vue/test-utils'
import HomeJurisdictionInformation from '@/components/auth/staff/continuation-in/HomeJurisdictionInformation.vue'
import Vue from 'vue'
import Vuetify from 'vuetify'
import flushPromises from 'flush-promises'

Vue.use(Vuetify)

const localVue = createLocalVue()
const vuetify = new Vuetify({})

const continuationReview = {
filing: {
continuationIn: {
authorization: {
date: '2024-07-01',
files: [
{
fileKey: '0071dbd6-6095-46f6-b5e4-cc859b0ebf27.pdf',
fileName: 'Change of Registration Application.pdf'
},
{
fileKey: 'xxx.pdf',
fileName: 'Invalid File.pdf'
}
]
},
foreignJurisdiction: {
affidavitFileKey: '007bd7bd-d421-49a9-9925-03ce561d044f.pdf',
affidavitFileName: 'MyAffidavit.pdf',
country: 'CA',
identifier: 'AB-5444',
incorporationDate: '2001-04-02',
legalName: 'FIRST AWIQ SHOPPING CENTRES ALBERTA UNLIMITED',
region: 'AB',
taxId: '123456789'
}
}
}
}

describe('HomeJurisdictionInformation component', () => {
let wrapper: Wrapper<HomeJurisdictionInformation>

beforeAll(async () => {
wrapper = mount(HomeJurisdictionInformation, {
localVue,
propsData: { continuationReview },
vuetify
})

// wait for things to stabilize
await flushPromises()

vi.resetModules()
vi.clearAllMocks()
})

afterAll(() => {
wrapper.destroy()
})

it('rendered the component', () => {
expect(wrapper.vm).toBeTruthy()
expect(wrapper.find('#home-jurisdiction-information').exists()).toBe(true)
})

it('got the prop', () => {
expect(wrapper.vm.continuationReview).toBeTruthy()
})

it('computed "homeJurisdiction"', () => {
expect(wrapper.vm.homeJurisdiction).toBe('Alberta')
})

it('computed "identifier"', () => {
expect(wrapper.vm.identifier).toBe('AB-5444')
})

it('computed "legalName"', () => {
expect(wrapper.vm.legalName).toBe('FIRST AWIQ SHOPPING CENTRES ALBERTA UNLIMITED')
})

it('computed "taxId"', () => {
expect(wrapper.vm.taxId).toBe('123456789')
})

it('computed "incorporationDate"', () => {
expect(wrapper.vm.incorporationDate).toBe('April 2, 2001')
})

it.skip('computed "authorizationFiles"', () => {
expect(wrapper.vm.authorizationFiles).toBe(true)
})

it('computed "authorizationDate"', () => {
expect(wrapper.vm.authorizationDate).toBe('July 1, 2024')
})

it('rendered the error dialog', () => {
expect(wrapper.find('.notify-dialog').exists()).toBe(true)
})

// it('rendered the container header', () => {
// expect(wrapper.find('.view-header').exists()).toBe(true)
// expect(wrapper.find('h1').text()).toBe('Continuation Authorization Review')
// })

// it('rendered the first v-card', () => {
// const vcard1 = wrapper.find('#extraprovincial-registration-bc-vcard')
// expect(vcard1.exists()).toBe(true)
// expect(vcard1.find('header').text()).toBe('Extraprovincial Registration in B.C.')
// expect(vcard1.find('extraprovincialregistrationbc-stub').exists()).toBe(true)
// })
})

0 comments on commit 78666ad

Please sign in to comment.