Skip to content

test(units): improve test structure and expand coverage across all unit modules#242

Merged
michaeljymsgutierrez merged 10 commits into
developfrom
test/improve-test-structure-and-coverage
Jun 30, 2026
Merged

test(units): improve test structure and expand coverage across all unit modules#242
michaeljymsgutierrez merged 10 commits into
developfrom
test/improve-test-structure-and-coverage

Conversation

@michaeljymsgutierrez

Copy link
Copy Markdown
Owner

Description

Improves the test suite structure and expands coverage across all unit test modules. Adds beforeEach collection resets to eliminate cross-test state leakage, removes redundant boilerplate inside individual tests, fixes a silent no-op (setNamespace on a frozen instance), and adds 18 new test cases covering previously untested behaviors introduced across recent releases.

Github Issue: N/A

Changes

  • packages/tests/mirage/index.js - added POST /addresses route to support save() on new records
  • packages/tests/units/init.js - added setPayloadIncludeReference test using a fresh ARM instance (shared instance is frozen via setGlobal())
  • packages/tests/units/request.js - added beforeEach collection reset, removed no-op setNamespace, added autoResolve default behavior test
  • packages/tests/units/retrieve.js - added beforeEach collection reset, removed no-op setNamespace, added peekRecord undefined and getAlias fallback tests
  • packages/tests/units/remove.js - added beforeEach collection reset, removed no-op setNamespace, added alias cleanup test for unloadRecord
  • packages/tests/units/push.js - added beforeEach collection reset, removed no-op setNamespace, added pushPayload with included data test
  • packages/tests/units/create.js - added beforeEach collection reset, removed no-op setNamespace, added createRecord with custom attributes test
  • packages/tests/units/record.js - added beforeEach collection reset, removed no-op setNamespace and redundant boilerplate from all existing tests, added save POST for new record, save with string record ID (v2.9.0), and rollbackAttributes after setProperties tests
  • packages/tests/units/utils.js - added sortBy ascending direction, findBy no-match, filterBy no-match, and mergeObjects deduplication tests
  • packages/tests/units/internals.js - removed no-op setNamespace, fixed _getBaseURL assertion to reflect frozen namespace (api/v2), added _injectCollectionReferenceKeys default values test

Screenshots/Images

N/A

How Has This Been Tested?

  • Full test suite run via yarn test - all 81 tests pass with no regressions

Checklist

  • Code follows the project's coding standards and best practices.
  • Existing tests pass.
  • Documentation is updated to reflect changes.
  • The PR is assigned to the correct reviewers.

Reviewer Guidance

  • Run yarn test inside packages/ and verify all 81 tests pass
  • Note that setNamespace calls outside describe/test blocks were no-ops because the shared ARM instance is frozen via setGlobal() - removing them makes the code honest
  • The _getBaseURL assertion now correctly reflects api/v2 (the namespace frozen at init time), not api/v1
  • The setPayloadIncludeReference test uses a fresh ApiResourceManager instance because plain (non-observable) properties cannot be mutated on the frozen shared instance
  • The autoResolve test only asserts the initial hash shape - when XHR completes, _pushRequestHash replaces (not mutates) the entry, making the captured reference stale

@michaeljymsgutierrez michaeljymsgutierrez self-assigned this Jun 30, 2026
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
arm-js-library-demo Ready Ready Preview, Comment Jun 30, 2026 4:35pm

@michaeljymsgutierrez michaeljymsgutierrez added the chore Maintenance tasks, configs, and cleanups label Jun 30, 2026
@michaeljymsgutierrez michaeljymsgutierrez merged commit 8cf2be1 into develop Jun 30, 2026
3 checks passed
@michaeljymsgutierrez michaeljymsgutierrez deleted the test/improve-test-structure-and-coverage branch June 30, 2026 16:38
michaeljymsgutierrez added a commit that referenced this pull request Jun 30, 2026
- [c099dd9][michaeljymsgutierrez]: Updated release version from v2.9.0 to v2.9.1 - 2026-07-01 02:27:36
- [9ca0c99][Chael Gutierrez]: fix(deploy): rename release branch prefix to releases to avoid ref collision (#245) - 2026-07-01 02:26:00
- [f823754][Chael Gutierrez]: chore(deps): fix dependabot security alerts - upgrade vite, vitest, form-data and markdown-it (#244) - 2026-07-01 01:55:56
- [2fcec47][Chael Gutierrez]: chore(deploy): add pre-flight checks, dry-run mode, canary sync, path safety and fail-fast (#243) - 2026-07-01 01:36:47
- [8cf2be1][Chael Gutierrez]: test(units): improve test structure and expand coverage across all unit modules (#242) - 2026-07-01 00:38:33
- [81e929f][Chael Gutierrez]: docs(contributing): add branch purposes, flow diagram, and toc updates (#241) - 2026-06-29 02:27:20
- [9e02459][Chael Gutierrez]: docs(contributing): add CONTRIBUTING.md and link from README (#240) - 2026-06-29 02:07:47
- [b8e9297][Chael Gutierrez]: chore(deps): upgrade production dependencies (#239) - 2026-06-24 02:57:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance tasks, configs, and cleanups

Projects

Development

Successfully merging this pull request may close these issues.

1 participant