Skip to content

Commit 389fc36

Browse files
test(search): align snapshots with protocol wrapper
Keep the modern text assertion aligned with structured content after the shared output wrapper change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 9b75ca3 commit 389fc36

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

‎pkg/github/__toolsnaps__/search_commits.snap‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"type": "string"
7575
},
7676
"created_at": {
77+
"description": "Account creation time in RFC3339 format.",
7778
"type": "string"
7879
},
7980
"email": {
@@ -113,6 +114,7 @@
113114
"type": "string"
114115
},
115116
"updated_at": {
117+
"description": "Last profile update time in RFC3339 format.",
116118
"type": "string"
117119
}
118120
},
@@ -217,6 +219,7 @@
217219
"type": "string"
218220
},
219221
"created_at": {
222+
"description": "Account creation time in RFC3339 format.",
220223
"type": "string"
221224
},
222225
"email": {
@@ -256,6 +259,7 @@
256259
"type": "string"
257260
},
258261
"updated_at": {
262+
"description": "Last profile update time in RFC3339 format.",
259263
"type": "string"
260264
}
261265
},
@@ -389,6 +393,9 @@
389393
"incomplete_results",
390394
"items"
391395
],
392-
"type": "object"
396+
"type": [
397+
"null",
398+
"object"
399+
]
393400
}
394401
}

‎pkg/github/__toolsnaps__/search_orgs.snap‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"type": "string"
7373
},
7474
"created_at": {
75+
"description": "Account creation time in RFC3339 format.",
7576
"type": "string"
7677
},
7778
"email": {
@@ -111,6 +112,7 @@
111112
"type": "string"
112113
},
113114
"updated_at": {
115+
"description": "Last profile update time in RFC3339 format.",
114116
"type": "string"
115117
}
116118
},
@@ -156,6 +158,9 @@
156158
"incomplete_results",
157159
"items"
158160
],
159-
"type": "object"
161+
"type": [
162+
"null",
163+
"object"
164+
]
160165
}
161166
}

‎pkg/github/__toolsnaps__/search_users.snap‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"type": "string"
7373
},
7474
"created_at": {
75+
"description": "Account creation time in RFC3339 format.",
7576
"type": "string"
7677
},
7778
"email": {
@@ -111,6 +112,7 @@
111112
"type": "string"
112113
},
113114
"updated_at": {
115+
"description": "Last profile update time in RFC3339 format.",
114116
"type": "string"
115117
}
116118
},
@@ -156,6 +158,9 @@
156158
"incomplete_results",
157159
"items"
158160
],
159-
"type": "object"
161+
"type": [
162+
"null",
163+
"object"
164+
]
160165
}
161166
}

‎pkg/github/typed_account_repository_search_test.go‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ func TestTypedAccountRepositorySearchOutputs(t *testing.T) {
142142
require.NoError(t, err)
143143
require.False(t, result.IsError, "%+v", result)
144144
require.Len(t, result.Content, 1)
145-
assert.Equal(t, expected, getTextResult(t, result).Text)
145+
if protocol == inventory.ProtocolVersionMultiRoundTrip {
146+
assert.JSONEq(t, structured, getTextResult(t, result).Text)
147+
} else {
148+
assert.Equal(t, expected, getTextResult(t, result).Text)
149+
}
146150
require.NotNil(t, result.Meta)
147151
label := unmarshalIFC(t, result.Meta["ifc"])
148152
if tool.Tool.Name == "search_commits" && body == fixture.body {
@@ -158,6 +162,7 @@ func TestTypedAccountRepositorySearchOutputs(t *testing.T) {
158162
require.NotNil(t, result.StructuredContent)
159163
encoded := mustMarshalJSON(t, result.StructuredContent)
160164
assert.JSONEq(t, structured, encoded)
165+
assert.JSONEq(t, encoded, getTextResult(t, result).Text)
161166
var output any
162167
require.NoError(t, json.Unmarshal([]byte(encoded), &output))
163168
require.NoError(t, resolved.Validate(output))

0 commit comments

Comments
 (0)