test(bskyweb): fail loudly on golden JSON unmarshal errors
This commit is contained in:
@@ -53,8 +53,12 @@ func TestBuildPassJSON_Golden(t *testing.T) {
|
|||||||
t.Fatalf("read golden: %v", err)
|
t.Fatalf("read golden: %v", err)
|
||||||
}
|
}
|
||||||
var gotMap, wantMap map[string]any
|
var gotMap, wantMap map[string]any
|
||||||
_ = json.Unmarshal(got, &gotMap)
|
if err := json.Unmarshal(got, &gotMap); err != nil {
|
||||||
_ = json.Unmarshal(want, &wantMap)
|
t.Fatalf("unmarshal got: %v", err)
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(want, &wantMap); err != nil {
|
||||||
|
t.Fatalf("unmarshal want: %v", err)
|
||||||
|
}
|
||||||
if !mapsEqual(gotMap, wantMap) {
|
if !mapsEqual(gotMap, wantMap) {
|
||||||
t.Errorf("pass.json drift; rerun with UPDATE_GOLDEN=1 to update.\n--- got ---\n%s\n--- want ---\n%s", got, want)
|
t.Errorf("pass.json drift; rerun with UPDATE_GOLDEN=1 to update.\n--- got ---\n%s\n--- want ---\n%s", got, want)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user