Skip to content

Conversation

@nev21
Copy link
Contributor

@nev21 nev21 commented Jan 23, 2026

Add deep equality key comparison for Maps and Sets with object keys. Implements anyDeepKeysFunc, allDeepKeysFunc, and six assert methods (hasAnyDeepKeys, hasAllDeepKeys, and their negations).

Addresses Chai v5.x compatibility for deep keys operations.

@nev21 nev21 added this to the 0.1.5 milestone Jan 23, 2026
Copilot AI review requested due to automatic review settings January 23, 2026 07:17
Copy link
Contributor

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

Implements Chai-compatible “deep keys” assertions so Maps/Sets with object keys can be asserted via deep equality, and wires this into both the core expect/assert APIs and the Chai shim.

Changes:

  • Adds anyDeepKeysFunc / allDeepKeysFunc and integrates .deep.keys operation chaining.
  • Exposes new core assert APIs (hasAnyDeepKeys, hasAllDeepKeys, and negations) and updates type interfaces.
  • Adds/updates tests and documentation for deep-keys support (core + chai shim).

Reviewed changes

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

Show a summary per file
File Description
shim/chai/test/src/chaiAssert.test.ts Enables deep-keys-related Chai shim tests for Maps/Sets.
shim/chai/src/assert/chaiAssert.ts Adds Chai shim assert-method mappings for deep keys.
shim/chai/README.md Documents deep keys support in the Chai shim.
core/test/src/assert/assert.deepKeys.test.ts Adds core tests covering deep-keys behavior and edge cases.
core/src/assert/ops/keysOp.ts Adds deep key filter operations and deepKeysOp selector.
core/src/assert/ops/deepOp.ts Exposes .deep.keys chaining from the deep operation.
core/src/assert/ops/allOp.ts Adds .any.deep.keys / .all.deep.keys chaining support.
core/src/assert/interface/ops/IDeepOp.ts Extends IDeepOp to include keys operations.
core/src/assert/interface/ops/IAnyOp.ts Adds deep key operations to the any op typing/docs.
core/src/assert/interface/ops/IAllOp.ts Adds deep key operations to the all op typing/docs.
core/src/assert/interface/IAssertClass.ts Adds public assert method typings/docs for deep keys and negations.
core/src/assert/funcs/keysFunc.ts Implements deep key matching and improved key formatting for messages.
core/src/assert/assertClass.ts Registers new deep-keys assert functions and aliases.
core/README.md Documents core deep-keys support at a high level.
.github/copilot-instructions.md Adds contributor guidance for selecting @since versions for new features.

Copy link
Contributor

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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Add deep equality key comparison for Maps and Sets with object keys.
Implements anyDeepKeysFunc, allDeepKeysFunc, and six assert methods
(hasAnyDeepKeys, hasAllDeepKeys, and their negations).

Addresses Chai v5.x compatibility for deep keys operations.
Copy link
Contributor

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

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Comment on lines +16 to +21
map.set({ greeting: "hello", subject: "friend" }, "value1");
map.set({ message: "darkness", type: "familiar" }, "value2");

expect(map).to.have.any.deep.keys({ greeting: "hello", subject: "friend" });
expect(map).to.have.any.deep.keys({ message: "darkness", type: "familiar" });
expect(map).to.have.any.deep.keys([{ greeting: "hello", subject: "friend" }, { echo: "calling" }]);
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

This new test file includes multiple blank lines that contain trailing spaces (e.g., after the map.set(...) lines). With no-trailing-spaces enabled, this will generate lint warnings; please remove the trailing whitespace (ideally across the whole file).

Copilot uses AI. Check for mistakes.
Comment on lines +344 to +350
// Deep keys operations
hasAnyDeepKeys: { scopeFn: createExprAdapter("has.any.deep.keys"), nArgs: 2 },
hasAllDeepKeys: { scopeFn: createExprAdapter("has.all.deep.keys"), nArgs: 2 },
notHaveAnyDeepKeys: { scopeFn: createExprAdapter("not.has.any.deep.keys"), nArgs: 2 },
doesNotHaveAnyDeepKeys: { alias: "notHaveAnyDeepKeys" },
notHaveAllDeepKeys: { scopeFn: createExprAdapter("not.has.all.deep.keys"), nArgs: 2 },
doesNotHaveAllDeepKeys: { alias: "notHaveAllDeepKeys" }
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

New core assert API methods were added (hasAnyDeepKeys, hasAllDeepKeys, notHaveAnyDeepKeys/doesNotHaveAnyDeepKeys, notHaveAllDeepKeys/doesNotHaveAllDeepKeys), but there are no corresponding unit tests in core/test/src/assert/ covering these assert entry points. There is extensive coverage for other assert.* methods, so please add tests validating both passing and failing cases for these new methods (including Map/Set object-key scenarios and the alias methods).

Copilot generated this review using guidance from repository custom instructions.
@nev21 nev21 closed this Jan 23, 2026
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