Skip to content

Enhance jsonvalue_test.go with edge case tests - #64060

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

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants