(t *testing.T)
| 175 | } |
| 176 | |
| 177 | func 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 | |
| 193 | func TestToolSnapKeysSorted(t *testing.T) { |
| 194 | withIsolatedWorkingDir(t) |
nothing calls this directly
no test coverage detected