mirror of
https://github.com/MeshCore-Beacon/beacon-server.git
synced 2026-10-22 14:11:27 +00:00
Port the qualified server preview at84ac3c8781onto org devc7209b7043. Preserve upstream changes and branch policies; keep the independent private Collector service separate. Preview-Version: 2.2.0-n30nex.1 Preview-Revision:84ac3c8781
23 lines
575 B
Go
23 lines
575 B
Go
// Copyright 2026 Beacon Contributors
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
package handlers
|
|
|
|
import (
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestTopologyWindowValidation(t *testing.T) {
|
|
for _, window := range []string{"", "15m", "1h", "24h", "72h", "0", "garbage"} {
|
|
w := httptest.NewRecorder()
|
|
RoutesRouter(stubReader{}).ServeHTTP(w, httptest.NewRequest("GET", "/topology?window="+window, nil))
|
|
want := 200
|
|
if window == "72h" || window == "0" || window == "garbage" {
|
|
want = 400
|
|
}
|
|
if w.Code != want {
|
|
t.Fatalf("%s: %d", window, w.Code)
|
|
}
|
|
}
|
|
}
|