Skip to content

Conversation

@loneil
Copy link
Collaborator

@loneil loneil commented Feb 9, 2026

Issue #: /bcgov/entity#31954

Description of changes:
Add a new postal code required validator that depends on country code as well.

Refactor-rename existing format validation for postal code as well

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the business-filings-ui license (Apache 2.0).

Signed-off-by: Lucas <lucasoneil@gmail.com>
@loneil loneil requested a review from Copilot February 9, 2026 23:30
@loneil loneil marked this pull request as ready for review February 9, 2026 23:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates postal code validation to separate “format validity” from “requiredness” and adds unit tests for the new required-postal-code validator.

Changes:

  • Renamed postal code validator to isValidPostalCode and updated existing unit tests.
  • Added new isRequiredPostalCode validator plus a dedicated unit test suite.
  • Updated validation mixin to support both isValidPostalCode and isRequiredPostalCode rules.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/validate-postal-code.spec.ts Updates tests to use isValidPostalCode and adds null/undefined coverage.
tests/unit/is-required-postal-code.spec.ts New unit tests for required postal code behavior across country sets.
src/validators/validate-postal-code.ts Renames exported validator function to isValidPostalCode.
src/validators/is-required-postal-code.ts Introduces isRequiredPostalCode validator and country allowlist.
src/validators/index.ts Updates validator exports to include isValidPostalCode and isRequiredPostalCode.
src/mixins/validation-mixin.ts Adds rule wiring for isValidPostalCode and isRequiredPostalCode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@severinbeauvais severinbeauvais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
I don't care if you streamline the unit tests or not.

@severinbeauvais severinbeauvais merged commit 190ad9c into bcgov:main Feb 9, 2026
10 checks passed
@loneil loneil deleted the 31954postalCode branch February 11, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants