Skip to content

[Test Improver] Add unit tests for aws.ts and kube.js utilities#17699

Merged
nwmac merged 2 commits into
masterfrom
test-assist/aws-kube-utils-tests-ad6b912e68042edd
May 18, 2026
Merged

[Test Improver] Add unit tests for aws.ts and kube.js utilities#17699
nwmac merged 2 commits into
masterfrom
test-assist/aws-kube-utils-tests-ad6b912e68042edd

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 Test Improver — automated AI assistant

Goal and Rationale

Add unit tests for two pure utility files with no test coverage:

  • shell/utils/aws.ts — exports four pure functions used across AWS provisioning flows: isIpv4Network, isIpv6Network, getVpcDisplayName, getSubnetDisplayName.
  • shell/utils/kube.js — exports normalizeName, a string normalization function that produces valid Kubernetes resource names.

Both are pure functions with clear semantics, real branching logic, and multiple edge cases worth verifying.

Approach

  • aws.test.ts: 17 tests covering all four exported functions — tag presence/absence, empty arrays, multiple tags, undefined fields, and the Ipv6CidrBlockAssociationSet array length check.
  • kube.test.ts: 12 tests covering normalizeName — whitespace trimming, case-folding, space-to-hyphen replacement, consecutive hyphen collapse, leading/trailing hyphen removal, and null/undefined inputs.
  • All tests use it.each with named object entries per project style.

Coverage Impact

File Before After
aws.ts — Stmts/Branches/Fns/Lines 0% 100%
kube.js — Stmts/Branches/Fns/Lines 0% 100%

Trade-offs

  • Purely testing public API of pure functions — low maintenance burden.
  • 29 tests total.

Reproducibility

node_modules/.bin/jest --no-coverage shell/utils/__tests__/aws.test.ts
node_modules/.bin/jest --no-coverage shell/utils/__tests__/kube.test.ts

Test Status

✅ All 29 new tests pass. No existing tests broken. Lint clean.

Fixes #

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • download.cypress.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "download.cypress.io"

See Network Configuration for more information.

Generated by Daily Test Improver · ● 4M ·

- aws.test.ts: 17 tests covering isIpv4Network, isIpv6Network,
  getVpcDisplayName, and getSubnetDisplayName with edge cases
  (absent tags, empty arrays, multiple tags, no Name key).
- kube.test.ts: 12 tests covering normalizeName with whitespace,
  case, hyphens, null/undefined, and mixed inputs.
- Combined coverage: 100% stmts/branches/fns/lines.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nwmac nwmac added this to the v2.15.0 milestone May 18, 2026
@nwmac nwmac marked this pull request as ready for review May 18, 2026 14:58
@nwmac nwmac merged commit 5ab6cec into master May 18, 2026
37 of 38 checks passed
@nwmac nwmac deleted the test-assist/aws-kube-utils-tests-ad6b912e68042edd branch May 18, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants