-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19359 - Amalgamating Businesses Table must have more than 1 (#628)
* Fixed amalgamating business length to be more than 1 * Rebased + fixed Sev's comment + added unit tests * Fixed lint issues * removed unneeded nextTick in tests
- Loading branch information
1 parent
fe44cf7
commit 7ae92bf
Showing
4 changed files
with
120 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,121 @@ describe('Business Table - display', () => { | |
} | ||
}) | ||
|
||
describe('Business Table - validity', () => { | ||
it('emit invalid when there are no businesses in the table', () => { | ||
const wrapper = wrapperFactory( | ||
BusinessTable, | ||
null, | ||
{ | ||
amalgamation: { | ||
amalgamatingBusinesses: [] | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.emitted('valid').pop()[0]).toEqual(false) | ||
}) | ||
|
||
it('emit invalid when there is only one business in the table', () => { | ||
const wrapper = wrapperFactory( | ||
BusinessTable, | ||
null, | ||
{ | ||
amalgamation: { | ||
amalgamatingBusinesses: [ | ||
{ | ||
address: { | ||
addressCity: 'Victoria', | ||
addressCountry: 'CA', | ||
addressRegion: 'BC', | ||
addressType: 'mailing', | ||
deliveryInstructions: '', | ||
postalCode: 'X8Y 1X1', | ||
streetAddress: 'test street', | ||
streetAddressAdditional: '' | ||
}, | ||
email: '[email protected]', | ||
identifier: 'BC1111111', | ||
isFrozen: false, | ||
isFutureEffective: false, | ||
isLimitedRestoration: false, | ||
isNotInGoodStanding: false, | ||
legalType: CorpTypeCd.BENEFIT_COMPANY, | ||
name: 'TEST BEN', | ||
role: AmlRoles.AMALGAMATING, | ||
status: AmlStatuses.OK, | ||
type: AmlTypes.LEAR | ||
} | ||
] | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.emitted('valid').pop()[0]).toEqual(false) | ||
}) | ||
|
||
it('emit valid when there are two or more businesses in the table', () => { | ||
const wrapper = wrapperFactory( | ||
BusinessTable, | ||
null, | ||
{ | ||
amalgamation: { | ||
amalgamatingBusinesses: [ | ||
{ | ||
address: { | ||
addressCity: 'Victoria', | ||
addressCountry: 'CA', | ||
addressRegion: 'BC', | ||
addressType: 'mailing', | ||
deliveryInstructions: '', | ||
postalCode: 'X8Y 1X1', | ||
streetAddress: 'test street', | ||
streetAddressAdditional: '' | ||
}, | ||
email: '[email protected]', | ||
identifier: 'BC1111111', | ||
isFrozen: false, | ||
isFutureEffective: false, | ||
isLimitedRestoration: false, | ||
isNotInGoodStanding: false, | ||
legalType: CorpTypeCd.BENEFIT_COMPANY, | ||
name: 'TEST BEN', | ||
role: AmlRoles.AMALGAMATING, | ||
status: AmlStatuses.OK, | ||
type: AmlTypes.LEAR | ||
}, | ||
{ | ||
address: { | ||
addressCity: 'Victoria', | ||
addressCountry: 'CA', | ||
addressRegion: 'BC', | ||
addressType: 'mailing', | ||
deliveryInstructions: '', | ||
postalCode: 'X8Y 1X2', | ||
streetAddress: 'test street 2', | ||
streetAddressAdditional: '' | ||
}, | ||
email: '[email protected]', | ||
identifier: 'BC2222222', | ||
isFrozen: false, | ||
isFutureEffective: false, | ||
isLimitedRestoration: false, | ||
isNotInGoodStanding: false, | ||
legalType: CorpTypeCd.BC_COMPANY, | ||
name: 'TEST BEN NUMBER 2', | ||
role: AmlRoles.AMALGAMATING, | ||
status: AmlStatuses.OK, | ||
type: AmlTypes.LEAR | ||
} | ||
] | ||
} | ||
} | ||
) | ||
|
||
expect(wrapper.emitted('valid').pop()[0]).toBe(true) | ||
}) | ||
}) | ||
|
||
// *** FUTURE: get this working | ||
// ATM, local rules are mocked (eg, wrapper.vm.notAffiliated()), but not the actual rules in the mixin. | ||
// It's probably this: https://vitest.dev/guide/mocking.html#mocking-pitfalls. | ||
|