Skip to content

Add comprehensive test coverage across all packages#26

Merged
Curstantine merged 1 commit intomasterfrom
copilot/analyze-test-coverage
Mar 27, 2026
Merged

Add comprehensive test coverage across all packages#26
Curstantine merged 1 commit intomasterfrom
copilot/analyze-test-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

Several exported functions had zero test coverage, and key edge cases were untested across all packages. This adds targeted tests for uncovered paths without modifying source code.

@jabascript/query

  • getLiteralValue — exported but completely untested; adds full describe block covering "null"null, "undefined"undefined, and passthrough strings
  • createSearchParams — empty array value, 2-element array not matching the Option pattern (falls through to regular array append), Option tuple with a missing key (serializes as "undefined")
  • parseSearchParamsnull/undefined within array entries, 3+ occurrences of the same non-[] key

@jabascript/form-data

  • 3-level deep nesting via dot notation
  • Duplicate key converting a scalar to a 2-element array, then growing beyond 2
  • Indexed arrays inside nested paths (e.g. order.items[0].sku)

@jabascript/core

  • createEnum — direct property access, empty object input
  • debounce — sequential independent calls both firing correctly
  • getInitials — partial options object (only separator, no none), both options provided together, lowercase input with separator that must uppercase

@Curstantine Curstantine marked this pull request as ready for review March 27, 2026 05:36
Copilot AI review requested due to automatic review settings March 27, 2026 05:36
@Curstantine Curstantine merged commit f1003ff into master Mar 27, 2026
3 checks passed
@Curstantine Curstantine deleted the copilot/analyze-test-coverage branch March 27, 2026 05:37
Copy link
Copy Markdown

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

Adds targeted Vitest coverage for previously untested/under-tested exported helpers across the monorepo packages, focusing on edge cases without changing production source.

Changes:

  • @jabascript/query: adds tests for getLiteralValue, additional createSearchParams fallthroughs, and parseSearchParams multi-value behavior.
  • @jabascript/form-data: adds tests for deeper dot-notation nesting, duplicate key aggregation, and indexed arrays inside nested paths.
  • @jabascript/core: adds tests for sequential debounce runs, getInitials option interactions, and createEnum direct property access / empty input.

Reviewed changes

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

File Description
packages/query/tests/index.test.js Expands query utility coverage including getLiteralValue and edge-case param parsing/serialization.
packages/form-data/tests/index.test.js Adds coverage for deeper nesting, repeated keys, and complex indexed paths in parseFormData.
packages/core/tests/index.test.js Adds coverage for sequential debounce usage and getInitials option combinations.
packages/core/tests/enum.test.js Adds coverage for direct enum property access and empty enum behavior.

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

Comment on lines +266 to +270
it("should skip null/undefined array entries by default", () => {
const searchParams = new URLSearchParams("ids[]=1&ids[]=null&ids[]=2");
const result = parseSearchParams(searchParams);
expect(result).toEqual({ "ids[]": ["1", null, "2"] });
});
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Test description says it "should skip null/undefined array entries by default", but the assertion expects the literal "null" entry to be preserved in the resulting array. This reads as contradictory and will mislead future readers; either update the test name to match the current behavior (arrays include null/undefined literals even when allowFalsy=false) or change the expectation/input to actually verify skipping behavior.

Copilot uses AI. Check for mistakes.
expect(getInitials("John", undefined)).toBe("Jo");
});

it("should use default none fallback when options object provides only separator", () => {
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The test name says it "should use default none fallback" when only { separator } is provided, but the expectation is undefined (i.e., no fallback applied). Rename the test to reflect the actual behavior being asserted, or (if the default is intended to be "N/A" per the function docs) adjust the expectation and implementation accordingly.

Suggested change
it("should use default none fallback when options object provides only separator", () => {
it("should not apply none fallback when options object provides only separator", () => {

Copilot uses AI. Check for mistakes.
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.

3 participants