MCPcopy
hub / github.com/github/github-mcp-server / TestSortJSONKeysIdempotent

Function TestSortJSONKeysIdempotent

internal/toolsnaps/toolsnaps_test.go:177–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

175}
176
177func TestSortJSONKeysIdempotent(t *testing.T) {
178 // Given a JSON string that's already sorted
179 input := `{"a": 1, "b": {"x": 2, "y": 3}, "c": [{"m": 4, "n": 5}]}`
180
181 // When we sort it once
182 sorted1, err := sortJSONKeys([]byte(input))
183 require.NoError(t, err)
184
185 // And sort it again
186 sorted2, err := sortJSONKeys(sorted1)
187 require.NoError(t, err)
188
189 // Then the results should be identical
190 assert.Equal(t, string(sorted1), string(sorted2))
191}
192
193func TestToolSnapKeysSorted(t *testing.T) {
194 withIsolatedWorkingDir(t)

Callers

nothing calls this directly

Calls 1

sortJSONKeysFunction · 0.85

Tested by

no test coverage detected