lab 7 done
Skeleton contracts / contracts (pull_request) Blocked by required conditions

This commit is contained in:
Khakimov Dmitrij
2026-11-29 21:59:16 +03:00
parent 20afc2c790
commit 2a7418fc45
170 changed files with 10332 additions and 96 deletions
+21
View File
@@ -0,0 +1,21 @@
package dto
import (
"encoding/json"
"testing"
)
func TestMessageStrictFields(t *testing.T) {
for _, body := range []string{`null`, `[]`, `{}`, `{"text":null}`, `{"text":"x","attachment_ids":null}`, `{"text":"x","attachment_ids":"x"}`, `{"text":"x","extra":1}`} {
var r CreateMessageRequest
if err := json.Unmarshal([]byte(body), &r); err == nil {
t.Fatalf("accepted %s", body)
}
}
for _, body := range []string{`{"text":"x"}`, `{"text":"x","attachment_ids":[]}`, `{"text":"","attachment_ids":["id"]}`} {
var r CreateMessageRequest
if err := json.Unmarshal([]byte(body), &r); err != nil {
t.Fatalf("rejected %s: %v", body, err)
}
}
}