• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / codegate-ui / 13765011492

10 Mar 2025 12:46PM UTC coverage: 66.347% (-3.6%) from 69.903%
13765011492

Pull #368

github

web-flow
Merge aca3fc44f into db80e1ec2
Pull Request #368: fix: implement server side pagination in frontend

419 of 703 branches covered (59.6%)

Branch coverage included in aggregate %.

106 of 163 new or added lines in 19 files covered. (65.03%)

15 existing lines in 6 files now uncovered.

894 of 1276 relevant lines covered (70.06%)

42.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.07
/src/mocks/msw/handlers.ts
1
import { http, HttpResponse } from 'msw'
2
import mockedAlerts from '@/mocks/msw/fixtures/GET_ALERTS.json'
3
import mockedWorkspaces from '@/mocks/msw/fixtures/GET_WORKSPACES.json'
4
import mockedProviders from '@/mocks/msw/fixtures/GET_PROVIDERS.json'
5
import mockedProvidersModels from '@/mocks/msw/fixtures/GET_PROVIDERS_MODELS.json'
6
import { AlertSummary, ProviderType } from '@/api/generated'
7
import { mswEndpoint } from '@/test/msw-endpoint'
8
import { buildFilterablePaginatedMessagesHandler } from './mockers/paginated-messages-response.mock'
9

10
export const handlers = [
32✔
11
  http.get(mswEndpoint('/health'), () =>
12
    HttpResponse.json({
3✔
13
      current_version: 'foo',
14
      latest_version: 'bar',
15
      is_latest: false,
16
      error: null,
17
    })
18
  ),
19
  http.get(mswEndpoint('/api/v1/version'), () =>
20
    HttpResponse.json({ status: 'healthy' })
6✔
21
  ),
22
  http.get(mswEndpoint('/api/v1/workspaces/active'), () =>
23
    HttpResponse.json({
79✔
24
      workspaces: [
25
        {
26
          name: 'my-awesome-workspace',
27
          is_active: true,
28
          last_updated: new Date(Date.now()).toISOString(),
29
        },
30
      ],
31
    })
32
  ),
33
  http.get(
34
    mswEndpoint('/api/v1/workspaces/:workspace_name/messages'),
35
    buildFilterablePaginatedMessagesHandler()
36
  ),
37
  http.get(mswEndpoint('/api/v1/workspaces/:workspace_name/alerts'), () => {
UNCOV
38
    return HttpResponse.json(mockedAlerts)
×
39
  }),
40
  http.get(
41
    mswEndpoint('/api/v1/workspaces/:workspace_name/alerts-summary'),
42
    () => {
43
      const response: AlertSummary = {
18✔
44
        malicious_packages: 13,
45
        pii: 9,
46
        secrets: 10,
47
        total_alerts: 32,
48
      }
49
      return HttpResponse.json(response)
18✔
50
    }
51
  ),
52
  http.get(mswEndpoint('/api/v1/workspaces'), () => {
53
    return HttpResponse.json(mockedWorkspaces)
25✔
54
  }),
55
  http.get(mswEndpoint('/api/v1/workspaces/archive'), () => {
56
    return HttpResponse.json({
34✔
57
      workspaces: [
58
        {
59
          name: 'archived_workspace',
60
          is_active: false,
61
        },
62
      ],
63
    })
64
  }),
65
  http.post(mswEndpoint('/api/v1/workspaces'), () => {
66
    return HttpResponse.json(mockedWorkspaces)
2✔
67
  }),
68
  http.post(
69
    mswEndpoint('/api/v1/workspaces/active'),
70
    () => new HttpResponse(null, { status: 204 })
3✔
71
  ),
72
  http.put(mswEndpoint('/api/v1/workspaces/:workspace_name'), () =>
73
    HttpResponse.json(
2✔
74
      {
75
        name: 'foo',
76
        config: {
77
          custom_instructions: '',
78
          muxing_rules: [],
79
        },
80
      },
81
      { status: 201 }
82
    )
83
  ),
84
  http.post(
85
    mswEndpoint('/api/v1/workspaces/archive/:workspace_name/recover'),
86
    () => new HttpResponse(null, { status: 204 })
2✔
87
  ),
88
  http.delete(
89
    mswEndpoint('/api/v1/workspaces/:workspace_name'),
90
    () => new HttpResponse(null, { status: 204 })
2✔
91
  ),
92
  http.delete(
93
    mswEndpoint('/api/v1/workspaces/archive/:workspace_name'),
94
    () => new HttpResponse(null, { status: 204 })
2✔
95
  ),
96
  http.get(
97
    mswEndpoint('/api/v1/workspaces/:workspace_name/custom-instructions'),
98
    () => {
99
      return HttpResponse.json({ prompt: 'foo' })
9✔
100
    }
101
  ),
102
  http.get(
103
    mswEndpoint('/api/v1/workspaces/:workspace_name/token-usage'),
104
    () => {
105
      return HttpResponse.json({
12✔
106
        tokens_by_model: {
107
          'claude-3-5-sonnet-latest': {
108
            provider_type: ProviderType.ANTHROPIC,
109
            model: 'claude-3-5-sonnet-latest',
110
            token_usage: {
111
              input_tokens: 1183,
112
              output_tokens: 433,
113
              input_cost: 0.003549,
114
              output_cost: 0.006495,
115
            },
116
          },
117
        },
118
        token_usage: {
119
          input_tokens: 1183,
120
          output_tokens: 433,
121
          input_cost: 0.003549,
122
          output_cost: 0.006495,
123
        },
124
      })
125
    }
126
  ),
127
  http.put(
128
    mswEndpoint('/api/v1/workspaces/:workspace_name/custom-instructions'),
129
    () => new HttpResponse(null, { status: 204 })
1✔
130
  ),
131
  http.get(mswEndpoint('/api/v1/workspaces/:workspace_name/muxes'), () =>
132
    HttpResponse.json([])
13✔
133
  ),
134
  http.put(
135
    mswEndpoint('/api/v1/workspaces/:workspace_name/muxes'),
136
    () => new HttpResponse(null, { status: 204 })
1✔
137
  ),
138
  http.get(mswEndpoint('/api/v1/provider-endpoints/:provider_id/models'), () =>
139
    HttpResponse.json(mockedProvidersModels)
×
140
  ),
141
  http.get(mswEndpoint('/api/v1/provider-endpoints/models'), () =>
142
    HttpResponse.json(mockedProvidersModels)
12✔
143
  ),
144
  http.get(mswEndpoint('/api/v1/provider-endpoints/:provider_id'), () =>
145
    HttpResponse.json(mockedProviders[0])
×
146
  ),
147
  http.get(mswEndpoint('/api/v1/provider-endpoints'), () =>
148
    HttpResponse.json(mockedProviders)
×
149
  ),
150
  http.post(
151
    mswEndpoint('/api/v1/provider-endpoints'),
152
    () => new HttpResponse(null, { status: 204 })
×
153
  ),
154
  http.put(
155
    mswEndpoint('/api/v1/provider-endpoints'),
156
    () => new HttpResponse(null, { status: 204 })
×
157
  ),
158
  http.delete(
159
    mswEndpoint('/api/v1/provider-endpoints'),
160
    () => new HttpResponse(null, { status: 204 })
×
161
  ),
162
]
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc