Add limit and offset query params to GET /questions/type-definitions with total_count metadata. Update integration docs, Postman collection, and page clamping tests. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
655 B
Go
21 lines
655 B
Go
package questions
|
|
|
|
import "testing"
|
|
|
|
func TestClampQuestionTypeDefinitionPage_defaultsAndCaps(t *testing.T) {
|
|
limit, offset := clampQuestionTypeDefinitionPage(0, -5)
|
|
if limit != 20 || offset != 0 {
|
|
t.Fatalf("expected default limit=20 offset=0, got limit=%d offset=%d", limit, offset)
|
|
}
|
|
|
|
limit, offset = clampQuestionTypeDefinitionPage(500, 10)
|
|
if limit != 200 || offset != 10 {
|
|
t.Fatalf("expected capped limit=200 offset=10, got limit=%d offset=%d", limit, offset)
|
|
}
|
|
|
|
limit, offset = clampQuestionTypeDefinitionPage(50, 25)
|
|
if limit != 50 || offset != 25 {
|
|
t.Fatalf("expected limit=50 offset=25, got limit=%d offset=%d", limit, offset)
|
|
}
|
|
}
|