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

stacklok / codegate-ui / 13031292266

29 Jan 2025 12:27PM UTC coverage: 68.733% (+1.7%) from 67.071%
13031292266

Pull #220

github

web-flow
Merge 04fad425d into 25a531eba
Pull Request #220: feat(muxes): model overrides matcher

387 of 673 branches covered (57.5%)

Branch coverage included in aggregate %.

41 of 60 new or added lines in 8 files covered. (68.33%)

2 existing lines in 1 file now uncovered.

844 of 1118 relevant lines covered (75.49%)

63.88 hits per line

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

66.67
/src/mocks/msw/handlers.ts
1
import { http, HttpResponse } from "msw";
2
import mockedPrompts from "@/mocks/msw/fixtures/GET_MESSAGES.json";
3
import mockedAlerts from "@/mocks/msw/fixtures/GET_ALERTS.json";
4
import mockedWorkspaces from "@/mocks/msw/fixtures/GET_WORKSPACES.json";
5
import mockedProviders from "@/mocks/msw/fixtures/GET_PROVIDERS.json";
6

7
export const handlers = [
24✔
8
  http.get("*/health", () =>
9
    HttpResponse.json({
3✔
10
      current_version: "foo",
11
      latest_version: "bar",
12
      is_latest: false,
13
      error: null,
14
    }),
15
  ),
16
  http.get("*/api/v1/version", () => HttpResponse.json({ status: "healthy" })),
4✔
17
  http.get("*/api/v1/workspaces/active", () =>
18
    HttpResponse.json({
42✔
19
      workspaces: [
20
        {
21
          name: "my-awesome-workspace",
22
          is_active: true,
23
          last_updated: new Date(Date.now()).toISOString(),
24
        },
25
      ],
26
    }),
27
  ),
28
  http.get("*/api/v1/workspaces/:name/messages", () => {
29
    return HttpResponse.json(mockedPrompts);
4✔
30
  }),
31
  http.get("*/api/v1/workspaces/:name/alerts", () => {
32
    return HttpResponse.json(mockedAlerts);
8✔
33
  }),
34
  http.get("*/api/v1/workspaces", () => {
35
    return HttpResponse.json(mockedWorkspaces);
8✔
36
  }),
37
  http.get("*/api/v1/workspaces/archive", () => {
38
    return HttpResponse.json({
11✔
39
      workspaces: [
40
        {
41
          name: "archived_workspace",
42
          is_active: false,
43
        },
44
      ],
45
    });
46
  }),
47
  http.post("*/api/v1/workspaces", () => {
48
    return HttpResponse.json(mockedWorkspaces);
4✔
49
  }),
50
  http.post(
51
    "*/api/v1/workspaces/active",
52
    () => new HttpResponse(null, { status: 204 }),
2✔
53
  ),
54
  http.post(
55
    "*/api/v1/workspaces/archive/:workspace_name/recover",
56
    () => new HttpResponse(null, { status: 204 }),
2✔
57
  ),
58
  http.delete(
59
    "*/api/v1/workspaces/:name",
60
    () => new HttpResponse(null, { status: 204 }),
2✔
61
  ),
62
  http.delete(
63
    "*/api/v1/workspaces/archive/:name",
64
    () => new HttpResponse(null, { status: 204 }),
2✔
65
  ),
66
  http.get("*/api/v1/workspaces/:name/custom-instructions", () => {
67
    return HttpResponse.json({ prompt: "foo" });
5✔
68
  }),
69
  http.put(
70
    "*/api/v1/workspaces/:name/custom-instructions",
71
    () => new HttpResponse(null, { status: 204 }),
1✔
72
  ),
73
  http.get("*/api/v1/workspaces/:workspace_name/muxes", () =>
74
    HttpResponse.json([
×
75
      {
76
        provider: "openai",
77
        model: "gpt-3.5-turbo",
78
        matcher_type: "file_regex",
79
        matcher: ".*\\.txt",
80
      },
81
      {
82
        provider: "anthropic",
83
        model: "davinci",
84
        matcher_type: "catch_all",
85
      },
86
    ]),
87
  ),
88
  http.put(
89
    "*/api/v1/workspaces/:workspace_name/muxes",
90
    () => new HttpResponse(null, { status: 204 }),
3✔
91
  ),
92
  http.get("*/api/v1/provider-endpoints", () =>
93
    HttpResponse.json(mockedProviders),
×
94
  ),
95
  http.get("*/api/v1/provider-endpoints/:provider_id", () =>
96
    HttpResponse.json(mockedProviders[0]),
×
97
  ),
98
  http.post(
99
    "*/api/v1/provider-endpoints",
100
    () => new HttpResponse(null, { status: 204 }),
×
101
  ),
102
  http.put(
103
    "*/api/v1/provider-endpoints",
104
    () => new HttpResponse(null, { status: 204 }),
×
105
  ),
106
  http.delete(
107
    "*/api/v1/provider-endpoints",
108
    () => new HttpResponse(null, { status: 204 }),
×
109
  ),
110
  http.get("*/api/v1/provider-endpoints/:provider_name/models", () =>
NEW
111
    HttpResponse.json([
×
112
      { name: "claude-3.5", provider: "anthropic" },
113
      { name: "claude-3.6", provider: "anthropic" },
114
      { name: "claude-3.7", provider: "anthropic" },
115
      { name: "chatgpt-4o", provider: "openai" },
116
      { name: "chatgpt-4p", provider: "openai" },
117
    ]),
118
  ),
119
  http.get("*/api/v1/provider-endpoints/models", () =>
NEW
120
    HttpResponse.json([
×
121
      { name: "claude-3.5", provider: "anthropic" },
122
      { name: "claude-3.6", provider: "anthropic" },
123
      { name: "claude-3.7", provider: "anthropic" },
124
      { name: "chatgpt-4o", provider: "openai" },
125
      { name: "chatgpt-4p", provider: "openai" },
126
    ]),
127
  ),
128
];
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