fix
This commit is contained in:
@@ -46,6 +46,7 @@ func TestV1ProcessJobItemMarshalJSON_order(t *testing.T) {
|
||||
"category": "Hladilniki",
|
||||
"category_id": "11",
|
||||
"processed_product_id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
|
||||
"gpt_response": "should-not-ship",
|
||||
"status": "processed",
|
||||
}
|
||||
b, err := item.MarshalJSON()
|
||||
@@ -56,11 +57,15 @@ func TestV1ProcessJobItemMarshalJSON_order(t *testing.T) {
|
||||
eanAt := strings.Index(s, `"ean"`)
|
||||
titleAt := strings.Index(s, `"title"`)
|
||||
attrsAt := strings.Index(s, `"attributes"`)
|
||||
ppAt := strings.Index(s, `"processed_product_id"`)
|
||||
if eanAt < 0 || titleAt < 0 || attrsAt < 0 || ppAt < 0 {
|
||||
if eanAt < 0 || titleAt < 0 || attrsAt < 0 {
|
||||
t.Fatalf("missing keys in %s", s)
|
||||
}
|
||||
if !(eanAt < titleAt && titleAt < attrsAt && attrsAt < ppAt) {
|
||||
if !(eanAt < titleAt && titleAt < attrsAt) {
|
||||
t.Fatalf("bad key order in %s", s)
|
||||
}
|
||||
for _, leak := range []string{`"processed_product_id"`, `"gpt_response"`} {
|
||||
if strings.Contains(s, leak) {
|
||||
t.Fatalf("allowlist MarshalJSON must omit %s: %s", leak, s)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user