oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package codex
2
3import "testing"
4
5func TestCodexRateLimitNotice(t *testing.T) {
6 raw := []byte(`{"method":"account/rateLimits/updated","params":{"rateLimits":{"limitId":"codex","planType":"promax","primary":{"usedPercent":100,"windowDurationMins":10080,"resetsAt":1794297404},"secondary":null,"credits":{"hasCredits":true,"unlimited":false,"balance":"1"}}}}`)
7 events, err := Decode(raw)
8 if err != nil || len(events) != 0 {
9 t.Fatalf("global rate notice became a session event: %+v %v", events, err)
10 }
11 for _, raw := range []string{
12 `{"id":1,"method":"account/rateLimits/updated","params":{"rateLimits":{}}}`,
13 `{"method":"account/rateLimits/updated","params":{"rateLimits":null}}`,
14 `{"method":"account/rateLimits/updated","params":{"rateLimits":{},"threadId":"other"}}`,
15 `{"method":"account/rateLimits/updated","params":{}}`,
16 } {
17 if _, err := Decode([]byte(raw)); err == nil {
18 t.Fatal("unexpected rate notice accepted", raw)
19 }
20 }
21}
22