Skip to content

Commit

Permalink
12309 Added SP/GP unit tests (#309)
Browse files Browse the repository at this point in the history
* - added SP/GP unit tests
- fixed a test suite
- app version = 3.3.2

* - used createComponent to simplify mount command
- fixed incorrect unit tests

* - parameterized unit tests
  • Loading branch information
severinbeauvais authored Jun 24, 2022
1 parent 9342e45 commit b6fb68c
Show file tree
Hide file tree
Showing 6 changed files with 600 additions and 153 deletions.
4 changes: 2 additions & 2 deletions 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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "business-edit-ui",
"version": "3.3.1",
"version": "3.3.2",
"private": true,
"appName": "Edit UI",
"sbcName": "SBC Common Components",
Expand Down
16 changes: 0 additions & 16 deletions src/assets/styles/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,3 @@
.form-row + .form-row {
margin-top: 0.25rem;
}

.form__btns {
display: flex;

.v-btn {
margin: 0;

+ .v-btn {
margin-left: 0.5rem;
}

&.form-primary-btn {
margin-left: auto;
}
}
}
56 changes: 36 additions & 20 deletions src/components/common/PeopleAndRoles/OrgPerson.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<!-- Person info -->
<template v-if="isPerson">
<!-- Name -->
<article>
<article class="person-name">
<label class="sub-header">Person's Name</label>

<p v-if="(isExisting && isProprietor)" class="info-text mb-0">
Expand Down Expand Up @@ -67,7 +67,7 @@

<!-- Confirm name change -->
<v-expand-transition>
<article v-if="hasNameChanged(orgPerson)" class="mt-6">
<article v-if="hasNameChanged(orgPerson)" class="confirm-name-change mt-6">
<v-checkbox
class="mt-0 pt-0"
id="confirm-name-change-checkbox"
Expand All @@ -85,15 +85,15 @@
</v-expand-transition>

<!-- Edit business number -->
<article v-if="showPersonEditBusNum" class="mt-6">
<article v-if="showPersonEditBusNum" class="edit-business-number mt-6">
<label class="sub-header">Business Number</label>
<p class="info-text">
If you have an existing business number, enter it below and we will contact the Canada
Revenue Agency and ask them to link it to this registration.
</p>
<v-text-field
filled persistent-hint
class="business-number mt-4 mb-n2"
class="mt-4 mb-n2"
label="Business Number (Optional)"
hint="First 9 digits of the CRA Business Number"
v-model.trim="orgPerson.officer.taxId"
Expand All @@ -103,7 +103,7 @@
</article>

<!-- Show business number -->
<article v-if="showPersonShowBusNum" class="mt-6">
<article v-if="showPersonShowBusNum" class="show-business-number mt-6">
<label class="sub-header">Business Number:</label>
<span class="sub-header-text">{{ orgPerson.officer.taxId || 'Not entered' }}</span>
</article>
Expand All @@ -112,7 +112,7 @@
<!-- Business or corporation info -->
<template v-if="isOrg">
<!-- Add firm org using look-up -->
<article v-if="showAddFirmOrgComponents && orgPerson.isLookupBusiness">
<article v-if="showAddFirmOrgComponents && orgPerson.isLookupBusiness" class="org-look-up">
<label class="sub-header">Business or Corporation Look Up</label>

<a class="lookup-toggle float-right" @click="toggleLookup()">
Expand Down Expand Up @@ -159,7 +159,7 @@

<!-- Add firm org manually (ie, unregistered in BC) -->
<template v-else-if="showAddFirmOrgComponents && !orgPerson.isLookupBusiness">
<article>
<article class="org-manual-entry">
<label class="sub-header">Business or Corporation Unregistered in B.C.</label>

<a class="lookup-toggle float-right" @click="toggleLookup()">
Expand Down Expand Up @@ -206,15 +206,15 @@
</article>

<!-- Business Number -->
<article class="mt-6">
<article class="edit-business-number mt-6">
<label class="sub-header">Business Number</label>
<p class="info-text">
If you have an existing business number, enter it below and we will contact
the Canada Revenue Agency and ask them to link it to this registration.
</p>
<v-text-field
filled persistent-hint
class="business-number mt-4 mb-n2"
class="mt-4 mb-n2"
label="Business Number (Optional)"
hint="First 9 digits of the CRA Business Number"
v-model.trim="orgPerson.officer.taxId"
Expand All @@ -226,7 +226,7 @@

<!-- Add non-firms + edit org -->
<template v-else>
<article>
<article class="other-edit-org">
<label class="sub-header">{{ orgTypesLabel }} Name</label>
<v-text-field
filled
Expand Down Expand Up @@ -258,13 +258,13 @@
</article>

<!-- Show incorporation number -->
<article v-if="orgPerson.officer.identifier" class="mt-6">
<article v-if="orgPerson.officer.identifier" class="incorporation-number mt-6">
<label class="sub-header">Incorporation/Registration Number:</label>
<span class="sub-header-text">{{ orgPerson.officer.identifier || 'Not entered' }}</span>
</article>

<!-- Edit business number -->
<article v-if="showOrgEditBusNum" class="mt-6">
<article v-if="showOrgEditBusNum" class="edit-business-number mt-6">
<label class="sub-header">Business Number</label>
<p class="info-text">
If an existing business number for this business or corporation is available, enter it
Expand All @@ -273,7 +273,7 @@
</p>
<v-text-field
filled persistent-hint
class="business-number mt-4 mb-n2"
class="mt-4 mb-n2"
label="Business Number (Optional)"
hint="First 9 digits of the CRA Business Number"
v-model.trim="orgPerson.officer.taxId"
Expand All @@ -283,21 +283,21 @@
</article>

<!-- Show business number (edit proprietor only) -->
<article v-if="showOrgShowBusNum" class="mt-6">
<article v-if="showOrgShowBusNum" class="show-business-number mt-6">
<label class="sub-header">Business Number:</label>
<span class="sub-header-text">{{ orgPerson.officer.taxId || 'Not entered' }}</span>
</article>
</template>
</template>

<!-- Email Address (proprietor/partner only) -->
<article v-if="(isProprietor || isPartner)" class="mt-6">
<article v-if="(isProprietor || isPartner)" class="email-address mt-6">
<label class="sub-header">Email Address</label>
<p class="info-text">
Copies of the registration documents will be sent to this email address.
</p>
<v-text-field
id="proprietor-email"
id="proprietor-partner-email"
:label="isEmailOptional ? 'Email Address (Optional)' : 'Email Address' "
filled
class="mb-n6"
Expand All @@ -309,7 +309,7 @@
</article>

<!-- Roles (BEN corrections only) -->
<article v-if="isBenIaCorrectionFiling" class="mt-6">
<article v-if="isBenIaCorrectionFiling" class="roles mt-6">
<label class="sub-header">Roles</label>
<v-row class="roles-row mt-4">
<v-col cols="4" class="mt-0" v-if="isPerson">
Expand Down Expand Up @@ -355,7 +355,7 @@
</article>

<!-- Mailing address -->
<article class="mt-6 mb-n6">
<article class="mailing-address mt-6 mb-n6">
<label class="sub-header">Mailing Address</label>
<div class="address-wrapper pt-4">
<!-- NB: prevent edit when business was looked up -->
Expand All @@ -371,7 +371,7 @@
</article>

<!-- Delivery address (director/proprietor/partner only) -->
<article v-if="isDirector || isProprietor || isPartner" class="mt-6">
<article v-if="isDirector || isProprietor || isPartner" class="delivery-address mt-6">
<v-checkbox
class="mt-0 pt-0 mb-n2"
label="Delivery Address same as Mailing Address"
Expand All @@ -398,7 +398,7 @@
</article>

<!-- Action buttons -->
<div class="form__btns mt-10 mb-6">
<div class="action-btns mt-10 mb-6">
<v-btn
v-if="showRemoveBtn"
id="btn-remove"
Expand Down Expand Up @@ -1295,4 +1295,20 @@ li {
color: $gray7;
margin-left: 0.5rem;
}
.action-btns {
display: flex;
.v-btn {
margin: 0;
+ .v-btn {
margin-left: 0.5rem;
}
&.form-primary-btn {
margin-left: auto;
}
}
}
</style>
40 changes: 24 additions & 16 deletions tests/unit/FmCorrection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,6 @@ describe('Firm Correction component', () => {

const get = sinon.stub(axios, 'get')

// GET auth info
get.withArgs('https://auth.api.url/entities/FM1234567')
.returns(Promise.resolve({
data: {
contacts: [
{
email: '[email protected]',
phone: '123-456-7890'
}
]
}
}))

// GET payment fee for immediate correction
get.withArgs('https://pay.api.url/fees/SP/CORRECTION')
.returns(Promise.resolve({
Expand Down Expand Up @@ -114,9 +101,11 @@ describe('Firm Correction component', () => {
get.withArgs('businesses/FM1234567/filings/123')
.returns(Promise.resolve({
data: {
business: {},
header: {},
incorporationApplication: {}
filing: {
business: {},
header: {},
registration: {}
}
}
}))

Expand All @@ -126,12 +115,31 @@ describe('Firm Correction component', () => {
data: { business: { legalType: 'SP' } }
}))

// GET auth info
get.withArgs('https://auth.api.url/entities/FM1234567')
.returns(Promise.resolve({
data: {
contacts: [
{
email: '[email protected]',
phone: '123-456-7890'
}
]
}
}))

// GET addresses
get.withArgs('businesses/FM1234567/addresses')
.returns(Promise.resolve({
data: {}
}))

// GET parties
get.withArgs('businesses/FM1234567/parties')
.returns(Promise.resolve({
data: { parties: [] }
}))

// create a Local Vue and install router on it
const localVue = createLocalVue()
localVue.use(VueRouter)
Expand Down
Loading

0 comments on commit b6fb68c

Please sign in to comment.