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

stacklok / codegate-ui / 13724706155

07 Mar 2025 04:14PM UTC coverage: 66.516% (-3.1%) from 69.62%
13724706155

Pull #355

github

web-flow
Merge 401ebe83b into db80e1ec2
Pull Request #355: [POC] feat: node-based muxing editor

424 of 711 branches covered (59.63%)

Branch coverage included in aggregate %.

22 of 89 new or added lines in 6 files covered. (24.72%)

81 existing lines in 4 files now uncovered.

903 of 1284 relevant lines covered (70.33%)

67.21 hits per line

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

77.78
/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 { ProviderType } from '@/api/generated'
7
import { mockConversation } from './mockers/conversation.mock'
8
import { mswEndpoint } from '@/test/msw-endpoint'
9

10
export const handlers = [
31✔
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({
82✔
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(mswEndpoint('/api/v1/workspaces/:workspace_name/messages'), () => {
34
    return HttpResponse.json(
15✔
35
      Array.from({ length: 10 }).map(() => mockConversation())
150✔
36
    )
37
  }),
38
  http.get(mswEndpoint('/api/v1/workspaces/:workspace_name/alerts'), () => {
39
    return HttpResponse.json(mockedAlerts)
15✔
40
  }),
41
  http.get(mswEndpoint('/api/v1/workspaces'), () => {
42
    return HttpResponse.json(mockedWorkspaces)
29✔
43
  }),
44
  http.get(mswEndpoint('/api/v1/workspaces/archive'), () => {
45
    return HttpResponse.json({
38✔
46
      workspaces: [
47
        {
48
          name: 'archived_workspace',
49
          is_active: false,
50
        },
51
      ],
52
    })
53
  }),
54
  http.post(mswEndpoint('/api/v1/workspaces'), () => {
55
    return HttpResponse.json(mockedWorkspaces)
2✔
56
  }),
57
  http.post(
58
    mswEndpoint('/api/v1/workspaces/active'),
59
    () => new HttpResponse(null, { status: 204 })
3✔
60
  ),
61
  http.put(mswEndpoint('/api/v1/workspaces/:workspace_name'), () =>
62
    HttpResponse.json(
2✔
63
      {
64
        name: 'foo',
65
        config: {
66
          custom_instructions: '',
67
          muxing_rules: [],
68
        },
69
      },
70
      { status: 201 }
71
    )
72
  ),
73
  http.post(
74
    mswEndpoint('/api/v1/workspaces/archive/:workspace_name/recover'),
75
    () => new HttpResponse(null, { status: 204 })
2✔
76
  ),
77
  http.delete(
78
    mswEndpoint('/api/v1/workspaces/:workspace_name'),
79
    () => new HttpResponse(null, { status: 204 })
2✔
80
  ),
81
  http.delete(
82
    mswEndpoint('/api/v1/workspaces/archive/:workspace_name'),
83
    () => new HttpResponse(null, { status: 204 })
2✔
84
  ),
85
  http.get(
86
    mswEndpoint('/api/v1/workspaces/:workspace_name/custom-instructions'),
87
    () => {
88
      return HttpResponse.json({ prompt: 'foo' })
9✔
89
    }
90
  ),
91
  http.get(
92
    mswEndpoint('/api/v1/workspaces/:workspace_name/token-usage'),
93
    () => {
94
      return HttpResponse.json({
15✔
95
        tokens_by_model: {
96
          'claude-3-5-sonnet-latest': {
97
            provider_type: ProviderType.ANTHROPIC,
98
            model: 'claude-3-5-sonnet-latest',
99
            token_usage: {
100
              input_tokens: 1183,
101
              output_tokens: 433,
102
              input_cost: 0.003549,
103
              output_cost: 0.006495,
104
            },
105
          },
106
        },
107
        token_usage: {
108
          input_tokens: 1183,
109
          output_tokens: 433,
110
          input_cost: 0.003549,
111
          output_cost: 0.006495,
112
        },
113
      })
114
    }
115
  ),
116
  http.put(
117
    mswEndpoint('/api/v1/workspaces/:workspace_name/custom-instructions'),
118
    () => new HttpResponse(null, { status: 204 })
1✔
119
  ),
120
  http.get(mswEndpoint('/api/v1/workspaces/:workspace_name/muxes'), () =>
121
    HttpResponse.json([])
13✔
122
  ),
123
  http.put(
124
    mswEndpoint('/api/v1/workspaces/:workspace_name/muxes'),
125
    () => new HttpResponse(null, { status: 204 })
1✔
126
  ),
127
  http.get(mswEndpoint('/api/v1/provider-endpoints/:provider_id/models'), () =>
UNCOV
128
    HttpResponse.json(mockedProvidersModels)
×
129
  ),
130
  http.get(mswEndpoint('/api/v1/provider-endpoints/models'), () =>
131
    HttpResponse.json(mockedProvidersModels)
12✔
132
  ),
133
  http.get(mswEndpoint('/api/v1/provider-endpoints/:provider_id'), () =>
UNCOV
134
    HttpResponse.json(mockedProviders[0])
×
135
  ),
136
  http.get(mswEndpoint('/api/v1/provider-endpoints'), () =>
137
    HttpResponse.json(mockedProviders)
×
138
  ),
139
  http.post(
140
    mswEndpoint('/api/v1/provider-endpoints'),
UNCOV
141
    () => new HttpResponse(null, { status: 204 })
×
142
  ),
143
  http.put(
144
    mswEndpoint('/api/v1/provider-endpoints'),
UNCOV
145
    () => new HttpResponse(null, { status: 204 })
×
146
  ),
147
  http.delete(
148
    mswEndpoint('/api/v1/provider-endpoints'),
UNCOV
149
    () => new HttpResponse(null, { status: 204 })
×
150
  ),
151
]
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