MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / TestListFeatures

Function TestListFeatures

backend/pkg/httpserver/get_features_test.go:32–584  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30)
31
32func TestListFeatures(t *testing.T) {
33 testCases := []struct {
34 name string
35 mockConfig *MockFeaturesSearchConfig
36 expectedCallCount int // For the mock method
37 expectedCacheCalls []*ExpectedCacheCall
38 expectedGetCalls []*ExpectedGetCall
39 request *http.Request
40 expectedResponse *http.Response
41 }{
42 {
43 name: "Success Case - no optional params - use defaults",
44 mockConfig: &MockFeaturesSearchConfig{
45 expectedPageToken: nil,
46 expectedPageSize: 100,
47 expectedSearchNode: nil,
48 expectedSortBy: nil,
49 expectedWPTMetricView: backend.TestCounts,
50 expectedBrowsers: []backend.BrowserPathParam{
51 backend.Chrome,
52 backend.Edge,
53 backend.Firefox,
54 backend.Safari,
55 backend.ChromeAndroid,
56 backend.FirefoxAndroid,
57 backend.SafariIos,
58 },
59 page: &backend.FeaturePage{
60 Metadata: backend.PageMetadataWithTotal{
61 NextPageToken: nil,
62 Total: 100,
63 },
64 Data: []backend.Feature{
65 {
66 Baseline: &backend.BaselineInfo{
67 Status: new(backend.Widely),
68 LowDate: new(
69 openapi_types.Date{Time: time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC)},
70 ),
71 HighDate: new(
72 openapi_types.Date{Time: time.Date(2001, time.January, 1, 0, 0, 0, 0, time.UTC)},
73 ),
74 },
75 FeatureId: "feature1",
76 Name: "feature 1",
77 Spec: nil,
78 Usage: nil,
79 Wpt: nil,
80 BrowserImplementations: &map[string]backend.BrowserImplementation{
81 "browser1": {
82 Status: new(backend.Available),
83 Date: nil,
84 Version: new("101"),
85 },
86 },
87 DeveloperSignals: nil,
88 Discouraged: nil,
89 VendorPositions: nil,

Callers

nothing calls this directly

Calls 2

getDefaultCacheConfigFunction · 0.85
testJSONResponseFunction · 0.85

Tested by

no test coverage detected