@@ -7,154 +7,148 @@ import * as M from "./entities";
7
7
import { MockGroup , MockWorkspaceQuota } from "./entities" ;
8
8
9
9
export const handlers = [
10
- http . get ( "/api/v2/templates/:templateId/daus" , async ( ) => {
10
+ http . get ( "/api/v2/templates/:templateId/daus" , ( ) => {
11
11
return HttpResponse . json ( M . MockTemplateDAUResponse ) ;
12
12
} ) ,
13
13
14
- http . get ( "/api/v2/insights/daus" , async ( ) => {
14
+ http . get ( "/api/v2/insights/daus" , ( ) => {
15
15
return HttpResponse . json ( M . MockDeploymentDAUResponse ) ;
16
16
} ) ,
17
17
// Workspace proxies
18
- http . get ( "/api/v2/regions" , async ( ) => {
18
+ http . get ( "/api/v2/regions" , ( ) => {
19
19
return HttpResponse . json ( {
20
20
regions : M . MockWorkspaceProxies ,
21
21
} ) ;
22
22
} ) ,
23
- http . get ( "/api/v2/workspaceproxies" , async ( ) => {
23
+ http . get ( "/api/v2/workspaceproxies" , ( ) => {
24
24
return HttpResponse . json ( {
25
25
regions : M . MockWorkspaceProxies ,
26
26
} ) ;
27
27
} ) ,
28
28
// build info
29
- http . get ( "/api/v2/buildinfo" , async ( ) => {
29
+ http . get ( "/api/v2/buildinfo" , ( ) => {
30
30
return HttpResponse . json ( M . MockBuildInfo ) ;
31
31
} ) ,
32
32
33
33
// experiments
34
- http . get ( "/api/v2/experiments" , async ( ) => {
34
+ http . get ( "/api/v2/experiments" , ( ) => {
35
35
return HttpResponse . json ( M . MockExperiments ) ;
36
36
} ) ,
37
37
38
38
// update check
39
- http . get ( "/api/v2/updatecheck" , async ( ) => {
39
+ http . get ( "/api/v2/updatecheck" , ( ) => {
40
40
return HttpResponse . json ( M . MockUpdateCheck ) ;
41
41
} ) ,
42
42
43
43
// organizations
44
- http . get ( "/api/v2/organizations/:organizationId" , async ( ) => {
44
+ http . get ( "/api/v2/organizations/:organizationId" , ( ) => {
45
45
return HttpResponse . json ( M . MockOrganization ) ;
46
46
} ) ,
47
47
http . get ( "api/v2/organizations/:organizationId/templates/examples" , ( ) => {
48
48
return HttpResponse . json ( [ M . MockTemplateExample , M . MockTemplateExample2 ] ) ;
49
49
} ) ,
50
50
http . get (
51
51
"/api/v2/organizations/:organizationId/templates/:templateId" ,
52
- async ( ) => {
52
+ ( ) => {
53
53
return HttpResponse . json ( M . MockTemplate ) ;
54
54
} ,
55
55
) ,
56
- http . get ( "/api/v2/organizations/:organizationId/templates" , async ( ) => {
56
+ http . get ( "/api/v2/organizations/:organizationId/templates" , ( ) => {
57
57
return HttpResponse . json ( [ M . MockTemplate ] ) ;
58
58
} ) ,
59
59
60
60
// templates
61
- http . get ( "/api/v2/templates/:templateId" , async ( ) => {
61
+ http . get ( "/api/v2/templates/:templateId" , ( ) => {
62
62
return HttpResponse . json ( M . MockTemplate ) ;
63
63
} ) ,
64
- http . get ( "/api/v2/templates/:templateId/versions" , async ( ) => {
64
+ http . get ( "/api/v2/templates/:templateId/versions" , ( ) => {
65
65
return HttpResponse . json ( [ M . MockTemplateVersion2 , M . MockTemplateVersion ] ) ;
66
66
} ) ,
67
- http . patch ( "/api/v2/templates/:templateId/versions" , async ( ) => {
67
+ http . patch ( "/api/v2/templates/:templateId/versions" , ( ) => {
68
68
return new HttpResponse ( null , { status : 200 } ) ;
69
69
} ) ,
70
- http . patch ( "/api/v2/templates/:templateId" , async ( ) => {
70
+ http . patch ( "/api/v2/templates/:templateId" , ( ) => {
71
71
return HttpResponse . json ( M . MockTemplate ) ;
72
72
} ) ,
73
- http . get ( "/api/v2/templateversions/:templateVersionId" , async ( ) => {
73
+ http . get ( "/api/v2/templateversions/:templateVersionId" , ( ) => {
74
74
return HttpResponse . json ( M . MockTemplateVersion ) ;
75
75
} ) ,
76
- http . get (
77
- "/api/v2/templateversions/:templateVersionId/resources" ,
78
- async ( ) => {
79
- return HttpResponse . json ( [
80
- M . MockWorkspaceResource ,
81
- M . MockWorkspaceVolumeResource ,
82
- M . MockWorkspaceImageResource ,
83
- M . MockWorkspaceContainerResource ,
84
- ] ) ;
85
- } ,
86
- ) ,
76
+ http . get ( "/api/v2/templateversions/:templateVersionId/resources" , ( ) => {
77
+ return HttpResponse . json ( [
78
+ M . MockWorkspaceResource ,
79
+ M . MockWorkspaceVolumeResource ,
80
+ M . MockWorkspaceImageResource ,
81
+ M . MockWorkspaceContainerResource ,
82
+ ] ) ;
83
+ } ) ,
87
84
http . get (
88
85
"/api/v2/templateversions/:templateVersionId/rich-parameters" ,
89
- async ( ) => {
90
- return HttpResponse . json ( [ ] ) ;
91
- } ,
92
- ) ,
93
- http . get (
94
- "/api/v2/templateversions/:templateVersionId/external-auth" ,
95
- async ( ) => {
86
+ ( ) => {
96
87
return HttpResponse . json ( [ ] ) ;
97
88
} ,
98
89
) ,
99
- http . get ( "/api/v2/templateversions/:templateversionId/logs" , async ( ) => {
90
+ http . get ( "/api/v2/templateversions/:templateVersionId/external-auth" , ( ) => {
91
+ return HttpResponse . json ( [ ] ) ;
92
+ } ) ,
93
+ http . get ( "/api/v2/templateversions/:templateversionId/logs" , ( ) => {
100
94
return HttpResponse . json ( M . MockWorkspaceBuildLogs ) ;
101
95
} ) ,
102
96
http . get (
103
97
"api/v2/organizations/:organizationId/templates/:templateName/versions/:templateVersionName" ,
104
- async ( ) => {
98
+ ( ) => {
105
99
return HttpResponse . json ( M . MockTemplateVersion ) ;
106
100
} ,
107
101
) ,
108
102
http . get (
109
103
"api/v2/organizations/:organizationId/templates/:templateName/versions/:templateVersionName/previous" ,
110
- async ( ) => {
104
+ ( ) => {
111
105
return HttpResponse . json ( M . MockTemplateVersion2 ) ;
112
106
} ,
113
107
) ,
114
- http . delete ( "/api/v2/templates/:templateId" , async ( ) => {
108
+ http . delete ( "/api/v2/templates/:templateId" , ( ) => {
115
109
return HttpResponse . json ( M . MockTemplate ) ;
116
110
} ) ,
117
111
118
112
// users
119
- http . get ( "/api/v2/users" , async ( ) => {
113
+ http . get ( "/api/v2/users" , ( ) => {
120
114
return HttpResponse . json ( {
121
115
users : [ M . MockUser , M . MockUser2 , M . SuspendedMockUser ] ,
122
116
count : 26 ,
123
117
} ) ;
124
118
} ) ,
125
- http . post ( "/api/v2/users" , async ( ) => {
119
+ http . post ( "/api/v2/users" , ( ) => {
126
120
return HttpResponse . json ( M . MockUser ) ;
127
121
} ) ,
128
- http . get ( "/api/v2/users/:userid/login-type" , async ( ) => {
122
+ http . get ( "/api/v2/users/:userid/login-type" , ( ) => {
129
123
return HttpResponse . json ( {
130
124
login_type : "password" ,
131
125
} ) ;
132
126
} ) ,
133
127
http . get ( "/api/v2/users/me/organizations" , ( ) => {
134
128
return HttpResponse . json ( [ M . MockOrganization ] ) ;
135
129
} ) ,
136
- http . get ( "/api/v2/users/me/organizations/:organizationId" , async ( ) => {
130
+ http . get ( "/api/v2/users/me/organizations/:organizationId" , ( ) => {
137
131
return HttpResponse . json ( M . MockOrganization ) ;
138
132
} ) ,
139
- http . post ( "/api/v2/users/login" , async ( ) => {
133
+ http . post ( "/api/v2/users/login" , ( ) => {
140
134
return HttpResponse . json ( M . MockSessionToken ) ;
141
135
} ) ,
142
- http . post ( "/api/v2/users/logout" , async ( ) => {
136
+ http . post ( "/api/v2/users/logout" , ( ) => {
143
137
return new HttpResponse ( null , { status : 200 } ) ;
144
138
} ) ,
145
- http . get ( "/api/v2/users/me" , async ( ) => {
139
+ http . get ( "/api/v2/users/me" , ( ) => {
146
140
return HttpResponse . json ( M . MockUser ) ;
147
141
} ) ,
148
- http . get ( "/api/v2/users/me/keys" , async ( ) => {
142
+ http . get ( "/api/v2/users/me/keys" , ( ) => {
149
143
return HttpResponse . json ( M . MockAPIKey ) ;
150
144
} ) ,
151
- http . get ( "/api/v2/users/authmethods" , async ( ) => {
145
+ http . get ( "/api/v2/users/authmethods" , ( ) => {
152
146
return HttpResponse . json ( M . MockAuthMethodsPasswordOnly ) ;
153
147
} ) ,
154
- http . get ( "/api/v2/users/roles" , async ( ) => {
148
+ http . get ( "/api/v2/users/roles" , ( ) => {
155
149
return HttpResponse . json ( M . MockSiteRoles ) ;
156
150
} ) ,
157
- http . post ( "/api/v2/authcheck" , async ( ) => {
151
+ http . post ( "/api/v2/authcheck" , ( ) => {
158
152
const permissions = [
159
153
...Object . keys ( permissionsToCheck ) ,
160
154
"canUpdateTemplate" ,
@@ -169,38 +163,38 @@ export const handlers = [
169
163
170
164
return HttpResponse . json ( response ) ;
171
165
} ) ,
172
- http . get ( "/api/v2/users/:userId/gitsshkey" , async ( ) => {
166
+ http . get ( "/api/v2/users/:userId/gitsshkey" , ( ) => {
173
167
return HttpResponse . json ( M . MockGitSSHKey ) ;
174
168
} ) ,
175
- http . get ( "/api/v2/users/:userId/workspace/:workspaceName" , async ( ) => {
169
+ http . get ( "/api/v2/users/:userId/workspace/:workspaceName" , ( ) => {
176
170
return HttpResponse . json ( M . MockWorkspace ) ;
177
171
} ) ,
178
172
179
173
// First user
180
- http . get ( "/api/v2/users/first" , async ( ) => {
174
+ http . get ( "/api/v2/users/first" , ( ) => {
181
175
return new HttpResponse ( null , { status : 200 } ) ;
182
176
} ) ,
183
- http . post ( "/api/v2/users/first" , async ( ) => {
177
+ http . post ( "/api/v2/users/first" , ( ) => {
184
178
return HttpResponse . json ( M . MockUser ) ;
185
179
} ) ,
186
180
187
181
// workspaces
188
- http . get ( "/api/v2/workspaces" , async ( ) => {
182
+ http . get ( "/api/v2/workspaces" , ( ) => {
189
183
return HttpResponse . json ( M . MockWorkspacesResponse ) ;
190
184
} ) ,
191
- http . get ( "/api/v2/workspaces/:workspaceId" , async ( ) => {
185
+ http . get ( "/api/v2/workspaces/:workspaceId" , ( ) => {
192
186
return HttpResponse . json ( M . MockWorkspace ) ;
193
187
} ) ,
194
- http . put ( "/api/v2/workspaces/:workspaceId/autostart" , async ( ) => {
188
+ http . put ( "/api/v2/workspaces/:workspaceId/autostart" , ( ) => {
195
189
return new HttpResponse ( null , { status : 200 } ) ;
196
190
} ) ,
197
- http . put ( "/api/v2/workspaces/:workspaceId/ttl" , async ( ) => {
191
+ http . put ( "/api/v2/workspaces/:workspaceId/ttl" , ( ) => {
198
192
return new HttpResponse ( null , { status : 200 } ) ;
199
193
} ) ,
200
- http . put ( "/api/v2/workspaces/:workspaceId/extend" , async ( ) => {
194
+ http . put ( "/api/v2/workspaces/:workspaceId/extend" , ( ) => {
201
195
return new HttpResponse ( null , { status : 200 } ) ;
202
196
} ) ,
203
- http . get ( "/api/v2/workspaces/:workspaceId/resolve-autostart" , async ( ) => {
197
+ http . get ( "/api/v2/workspaces/:workspaceId/resolve-autostart" , ( ) => {
204
198
return HttpResponse . json ( { parameter_mismatch : false } ) ;
205
199
} ) ,
206
200
@@ -216,7 +210,7 @@ export const handlers = [
216
210
const result = transitionToBuild [ transition ] ;
217
211
return HttpResponse . json ( result ) ;
218
212
} ) ,
219
- http . get ( "/api/v2/workspaces/:workspaceId/builds" , async ( ) => {
213
+ http . get ( "/api/v2/workspaces/:workspaceId/builds" , ( ) => {
220
214
return HttpResponse . json ( M . MockBuilds ) ;
221
215
} ) ,
222
216
http . get ( "/api/v2/workspaces/:workspaceId/port-share" , ( ) => {
@@ -270,7 +264,7 @@ export const handlers = [
270
264
return HttpResponse . json ( [ MockGroup ] ) ;
271
265
} ) ,
272
266
273
- http . post ( "/api/v2/organizations/:organizationId/groups" , async ( ) => {
267
+ http . post ( "/api/v2/organizations/:organizationId/groups" , ( ) => {
274
268
return HttpResponse . json ( M . MockGroup , { status : 201 } ) ;
275
269
} ) ,
276
270
0 commit comments