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 5, 2024
1 parent 483b672 commit 5356a03
Show file tree
Hide file tree
Showing 9 changed files with 320 additions and 17 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.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
sm="9"
class="pt-4 pt-sm-0"
>
<div id="name-bc">
<div id="registered-name-bc">
{{ legalName || '[Unknown]' }}
</div>
</v-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
sm="9"
class="pt-4 pt-sm-0"
>
<div id="name-home">
<div id="registered-name-home">
{{ legalName || '[Unknown]' }}
</div>
</v-col>
Expand Down
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
10 changes: 3 additions & 7 deletions auth-web/src/services/business.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default class BusinessService {
files: [
{
fileKey: '0071dbd6-6095-46f6-b5e4-cc859b0ebf27.pdf',
fileName: 'Change of Registration Application.pdf'
fileName: 'My Authorization Document.pdf'
},
{
fileKey: 'xxx.pdf',
Expand All @@ -132,7 +132,7 @@ export default class BusinessService {
},
foreignJurisdiction: {
affidavitFileKey: '007bd7bd-d421-49a9-9925-03ce561d044f.pdf',
affidavitFileName: 'MyAffidavit.pdf',
affidavitFileName: 'My Director Affidavit.pdf',
country: 'CA',
identifier: 'AB-5444',
incorporationDate: '2001-04-02',
Expand All @@ -157,6 +157,7 @@ export default class BusinessService {
* @param documentKey the document key
* @param documentName the document filename
* @returns a promise to return the axios response or the error response
* @see CommonUtils.fileDownload() for a similar method
*/
static async downloadDocument (documentKey: string, documentName: string): Promise<AxiosResponse> {
// safety checks
Expand All @@ -173,11 +174,6 @@ export default class BusinessService {
return axios.get(url, config).then(response => {
if (!response) throw new Error('Null response')

//
// The following is similar to CommonUtils.fileDownload() but the current method
// is more portable (for future move to a different UI).
//

/* solution below is from https://github.com/axios/axios/issues/1392 */

// it is necessary to create a new blob object with mime-type explicitly set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class ContinuationAuthorizationReview extends Vue {
}
/** Review ID that comes from route. */
@Prop({ default: 0 }) readonly reviewId: number
@Prop({ required: true }) readonly reviewId: number
// local variables
dialogTitle = ''
Expand Down
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)
})
})
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')
})
})
Loading

0 comments on commit 5356a03

Please sign in to comment.