MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestContextWindowFromHeaders

Function TestContextWindowFromHeaders

internal/cloud/cloud_test.go:123–148  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

121}
122
123func TestContextWindowFromHeaders(t *testing.T) {
124 cases := []struct {
125 name string
126 val string
127 want int
128 }{
129 {"missing", "", 0},
130 {"valid", "262144", 262144},
131 {"min boundary", "1024", 1024},
132 {"too small", "1023", 0},
133 {"too large", "9999999999", 0},
134 {"negative", "-1", 0},
135 {"garbage", "abc", 0},
136 }
137 for _, tc := range cases {
138 t.Run(tc.name, func(t *testing.T) {
139 h := http.Header{}
140 if tc.val != "" {
141 h.Set("X-Context-Window", tc.val)
142 }
143 if got := ContextWindowFromHeaders(h); got != tc.want {
144 t.Fatalf("want %d, got %d", tc.want, got)
145 }
146 })
147 }
148}
149
150func TestAuthHeader(t *testing.T) {
151 if AuthHeader("hp_abc") != "Bearer hp_abc" {

Callers

nothing calls this directly

Calls 1

ContextWindowFromHeadersFunction · 0.85

Tested by

no test coverage detected