Skip to content

Enhance jsonvalue_test.go with edge case tests - #64060

Closed
Deniz Güney Yıldırım (denizguney) wants to merge 2 commits into
microsoft:mainfrom
denizguney:patch-1
Closed

Enhance jsonvalue_test.go with edge case tests#64060
Deniz Güney Yıldırım (denizguney) wants to merge 2 commits into
microsoft:mainfrom
denizguney:patch-1

Conversation

@denizguney

Copy link
Copy Markdown

Add unit tests covering edge cases for jsonvalueToAny, including empty objects ({}), boolean types, and floating-point values to ensure robust parsing across various data structures.

Fixes #

Add unit tests covering edge cases for `jsonvalueToAny`, including empty objects (`{}`), boolean types, and floating-point values to ensure robust parsing across various data structures.
Copilot AI balanced review requested due to automatic review settings August 27, 2026 20:02
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Aug 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds unit coverage for additional jsonValueToAny JSON types.

Changes:

  • Tests empty objects, booleans, and floating-point values.

Comment thread tsc/internal/api/jsonvalue_test.go Outdated
Comment on lines +36 to +48

var edgeValue packagejson.JSONValue
err = json.Unmarshal([]byte(`{"emptyObj":{},"boolVal":true,"floatVal":3.14}`), &edgeValue)
assert.NilError(t, err)

edgeRoot := jsonValueToAny(edgeValue).(*collections.OrderedMap[string, any])


emptyObj := edgeRoot.GetOrZero("emptyObj").(*collections.OrderedMap[string, any])
assert.Equal(t, len(slices.Collect(emptyObj.Keys())), 0)


assert.Equal(t, edgeRoot.GetOrZero("boolVal"), true)
Fix Go formatting check by removing whitespace-only blank lines in jsonvalue_test.go.
@RyanCavanaugh

Copy link
Copy Markdown
Member

PRs need associated issues with them. This one in particular is confusing to reason about information about what motivated it.

@github-project-automation github-project-automation Bot moved this from Not started to Done in PR Backlog Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants