test: cover string user ids in workbench payloads

This commit is contained in:
richjohnrambo
2026-09-16 18:05:26 +08:00
parent 903a77f2c5
commit fc246c3086
3 changed files with 85 additions and 13 deletions
+3 -6
View File
@@ -22,12 +22,9 @@ func TestUserIDJSONAcceptsIMUserID(t *testing.T) {
}
}
func TestUserIDJSONStillAcceptsNumericID(t *testing.T) {
func TestUserIDJSONRejectsNumericID(t *testing.T) {
var id userID
if err := json.Unmarshal([]byte(`1573862062872858624`), &id); err != nil {
t.Fatalf("unmarshal numeric: %v", err)
}
if id != 1573862062872858624 {
t.Fatalf("id=%d", id)
if err := json.Unmarshal([]byte(`1573862062872858624`), &id); err == nil {
t.Fatal("expected numeric user id to be rejected")
}
}