-
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 5, 2024
1 parent
483b672
commit 5356a03
Showing
9 changed files
with
320 additions
and
17 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
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
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
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
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
89 changes: 89 additions & 0 deletions
89
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,89 @@ | ||
import { Wrapper, createLocalVue, mount } from '@vue/test-utils' | ||
import BusinessService from '@/services/business.services' | ||
import ContinuationAuthorizationReview from '@/views/auth/staff/ContinuationAuthorizationReview.vue' | ||
import ExtraprovincialRegistrationBc from '@/components/auth/staff/continuation-in/ExtraprovincialRegistrationBc.vue' | ||
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({}) | ||
|
||
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('got the prop', () => { | ||
expect(wrapper.vm.reviewId).toBe(123) | ||
}) | ||
|
||
it('fetched the continuation review object', () => { | ||
expect(wrapper.vm.continuationReview).toBeTruthy() | ||
}) | ||
|
||
it('computed "isExpro"', () => { | ||
expect(wrapper.vm.isExpro).toBe(true) | ||
}) | ||
|
||
it('rendered the component', () => { | ||
expect(wrapper.findComponent(ContinuationAuthorizationReview).exists()).toBe(true) | ||
expect(wrapper.find('#continuation-authorization-review').exists()).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.findComponent(ExtraprovincialRegistrationBc).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.findComponent(HomeJurisdictionInformation).exists()).toBe(true) | ||
}) | ||
}) |
73 changes: 73 additions & 0 deletions
73
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,73 @@ | ||
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() | ||
}) | ||
|
||
afterAll(() => { | ||
wrapper.destroy() | ||
}) | ||
|
||
it('got the prop', () => { | ||
expect(wrapper.vm.continuationReview).toBeTruthy() | ||
}) | ||
|
||
it('rendered the component', () => { | ||
expect(wrapper.findComponent(ExtraprovincialRegistrationBc).exists()).toBe(true) | ||
expect(wrapper.find('#extraprovincial-registration-bc').exists()).toBe(true) | ||
}) | ||
|
||
it('rendered all the articles', () => { | ||
const articles = wrapper.findAll('article') | ||
expect(articles.length).toBe(3) | ||
}) | ||
|
||
it('rendered the first article', () => { | ||
const article = wrapper.findAll('article').at(0) | ||
expect(article.find('label').text()).toBe('Registration Number in B.C.') | ||
expect(article.find('#registration-number-bc').text()).toBe('A0054444') | ||
}) | ||
|
||
it('rendered the second article', () => { | ||
const article = wrapper.findAll('article').at(1) | ||
expect(article.find('label').text()).toBe('Registered Name in B.C.') | ||
expect(article.find('#registered-name-bc').text()).toBe('FIRST AWIQ SHOPPING CENTRES BC LIMITED') | ||
}) | ||
|
||
it('rendered the third articles', () => { | ||
const article = wrapper.findAll('article').at(2) | ||
expect(article.find('label').text()).toBe('Date of Registration in B.C.') | ||
expect(article.find('#registration-date-bc').text()).toBe('May 3, 2001') | ||
}) | ||
}) |
Oops, something went wrong.