-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- unit tests (WIP)
- Loading branch information
Severin Beauvais
committed
Jul 4, 2024
1 parent
483b672
commit 78666ad
Showing
5 changed files
with
286 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
auth-web/tests/unit/components/ContinuationAuthorizationReview.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
}) | ||
}) |
77 changes: 77 additions & 0 deletions
77
auth-web/tests/unit/components/ExtraprovincialRegistrationBc.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
115
auth-web/tests/unit/components/HomeJurisdictionInformation.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
// }) | ||
}) |