feat: articles pagination
This commit is contained in:
1 parent
a2d224240c
commit
73f4b539fe
45 files changed
+3528
-317
No files matched your search
@@ -514,7 +514,13 @@ func TestAPIKeysHttp(t *testing.T) {
|
||||
raw, _ := env.issueKey(apiKeyDevId, "ci")
|
||||
ids := func(rec *httptest.ResponseRecorder) []float64 {
|
||||
result := []float64{}
|
||||
for _, entry := range apiKeyDecodeList(t, rec) {
|
||||
var envelope struct {
|
||||
Items []map[string]any `json:"items"`
|
||||
}
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &envelope); err != nil {
|
||||
t.Fatalf("expected an article envelope, got %q: %v", rec.Body.String(), err)
|
||||
}
|
||||
for _, entry := range envelope.Items {
|
||||
result = append(result, entry["id"].(float64))
|
||||
}
|
||||
return result
|
||||
@@ -522,7 +528,7 @@ func TestAPIKeysHttp(t *testing.T) {
|
||||
|
||||
withKey := env.withKey(t, http.MethodGet, "/v1/article", "", raw)
|
||||
assertAPIKeyStatus(t, withKey, http.StatusOK)
|
||||
if got := ids(withKey); len(got) != 2 || got[0] != 5 || got[1] != 6 {
|
||||
if got := ids(withKey); len(got) != 2 || got[0] != 6 || got[1] != 5 {
|
||||
t.Errorf("expected articles 5 and 6, got %v", got)
|
||||
}
|
||||
anonymous := env.anonymous(t, http.MethodGet, "/v1/article", "")
|
||||
|
||||
Reference in new issue
Block a user