1
- import {
2
- BuildInfoResponse ,
3
- Organization ,
4
- Provisioner ,
5
- Template ,
6
- UserAgent ,
7
- UserResponse ,
8
- Workspace ,
9
- WorkspaceAgent ,
10
- WorkspaceAutostartRequest ,
11
- WorkspaceResource ,
12
- } from "../api/types"
13
- import { AuthMethods , Role } from "../api/typesGenerated"
14
-
15
- export const MockSessionToken = { session_token : "my-session-token" }
16
-
17
- export const MockAPIKey = { key : "my-api-key" }
18
-
19
- export const MockBuildInfo : BuildInfoResponse = {
1
+ import * as Types from "../api/types"
2
+ import * as TypesGen from "../api/typesGenerated"
3
+
4
+ export const MockSessionToken : TypesGen . LoginWithPasswordResponse = {
5
+ session_token : "my-session-token" ,
6
+ }
7
+
8
+ export const MockAPIKey : TypesGen . GenerateAPIKeyResponse = {
9
+ key : "my-api-key" ,
10
+ }
11
+
12
+ export const MockBuildInfo : TypesGen . BuildInfoResponse = {
20
13
external_url : "file:///mock-url" ,
21
14
version : "v99.999.9999+c9cdf14" ,
22
15
}
23
16
24
- export const MockAdminRole : Role = {
17
+ export const MockAdminRole : TypesGen . Role = {
25
18
name : "admin" ,
26
19
display_name : "Admin" ,
27
20
}
28
21
29
- export const MockMemberRole : Role = {
22
+ export const MockMemberRole : TypesGen . Role = {
30
23
name : "member" ,
31
24
display_name : "Member" ,
32
25
}
33
26
34
- export const MockAuditorRole : Role = {
27
+ export const MockAuditorRole : TypesGen . Role = {
35
28
name : "auditor" ,
36
29
display_name : "Auditor" ,
37
30
}
38
31
39
32
export const MockSiteRoles = [ MockAdminRole , MockAuditorRole , MockMemberRole ]
40
33
41
- export const MockUser : UserResponse = {
34
+ export const MockUser : TypesGen . User = {
42
35
id : "test-user" ,
43
36
username : "TestUser" ,
44
37
email : "test@coder.com" ,
@@ -48,7 +41,7 @@ export const MockUser: UserResponse = {
48
41
roles : [ MockAdminRole , MockMemberRole ] ,
49
42
}
50
43
51
- export const MockUser2 : UserResponse = {
44
+ export const MockUser2 : TypesGen . User = {
52
45
id : "test-user-2" ,
53
46
username : "TestUser2" ,
54
47
email : "test2@coder.com" ,
@@ -58,80 +51,114 @@ export const MockUser2: UserResponse = {
58
51
roles : [ MockMemberRole ] ,
59
52
}
60
53
61
- export const MockOrganization : Organization = {
54
+ export const MockOrganization : TypesGen . Organization = {
62
55
id : "test-org" ,
63
56
name : "Test Organization" ,
64
57
created_at : "" ,
65
58
updated_at : "" ,
66
59
}
67
60
68
- export const MockProvisioner : Provisioner = {
61
+ export const MockProvisioner : TypesGen . ProvisionerDaemon = {
62
+ created_at : "" ,
69
63
id : "test-provisioner" ,
70
64
name : "Test Provisioner" ,
65
+ provisioners : [ ] ,
66
+ }
67
+
68
+ export const MockProvisionerJob : TypesGen . ProvisionerJob = {
69
+ created_at : "" ,
70
+ id : "test-provisioner-job" ,
71
+ status : "succeeded" ,
71
72
}
72
73
73
- export const MockTemplate : Template = {
74
+ export const MockTemplate : TypesGen . Template = {
74
75
id : "test-template" ,
75
76
created_at : "" ,
76
77
updated_at : "" ,
77
78
organization_id : MockOrganization . id ,
78
79
name : "Test Template" ,
79
80
provisioner : MockProvisioner . id ,
80
81
active_version_id : "" ,
82
+ workspace_owner_count : 1 ,
81
83
}
82
84
83
- export const MockWorkspaceAutostartDisabled : WorkspaceAutostartRequest = {
85
+ export const MockWorkspaceAutostartDisabled : TypesGen . UpdateWorkspaceAutostartRequest = {
84
86
schedule : "" ,
85
87
}
86
88
87
- export const MockWorkspaceAutostartEnabled : WorkspaceAutostartRequest = {
89
+ export const MockWorkspaceAutostartEnabled : TypesGen . UpdateWorkspaceAutostartRequest = {
88
90
// Runs at 9:30am Monday through Friday using Canada/Eastern
89
91
// (America/Toronto) time
90
92
schedule : "CRON_TZ=Canada/Eastern 30 9 * * 1-5" ,
91
93
}
92
94
93
- export const MockWorkspaceAutostopDisabled : WorkspaceAutostartRequest = {
95
+ export const MockWorkspaceAutostopDisabled : TypesGen . UpdateWorkspaceAutostartRequest = {
94
96
schedule : "" ,
95
97
}
96
98
97
- export const MockWorkspaceAutostopEnabled : WorkspaceAutostartRequest = {
99
+ export const MockWorkspaceAutostopEnabled : TypesGen . UpdateWorkspaceAutostartRequest = {
98
100
// Runs at 9:30pm Monday through Friday using America/Toronto
99
101
schedule : "CRON_TZ=America/Toronto 30 21 * * 1-5" ,
100
102
}
101
103
102
- export const MockWorkspace : Workspace = {
104
+ export const MockWorkspaceBuild : TypesGen . WorkspaceBuild = {
105
+ after_id : "" ,
106
+ before_id : "" ,
107
+ created_at : "" ,
108
+ id : "test-workspace-build" ,
109
+ initiator_id : "" ,
110
+ job : MockProvisionerJob ,
111
+ name : "a-workspace-build" ,
112
+ template_version_id : "" ,
113
+ transition : "start" ,
114
+ updated_at : "" ,
115
+ workspace_id : "test-workspace" ,
116
+ }
117
+
118
+ export const MockWorkspace : TypesGen . Workspace = {
103
119
id : "test-workspace" ,
104
120
name : "Test-Workspace" ,
105
121
created_at : "" ,
106
122
updated_at : "" ,
107
123
template_id : MockTemplate . id ,
124
+ template_name : MockTemplate . name ,
125
+ outdated : false ,
108
126
owner_id : MockUser . id ,
109
127
autostart_schedule : MockWorkspaceAutostartEnabled . schedule ,
110
128
autostop_schedule : MockWorkspaceAutostopEnabled . schedule ,
111
- latest_build : {
112
- id : "test-workspace-build" ,
113
- } ,
129
+ latest_build : MockWorkspaceBuild ,
114
130
}
115
131
116
- export const MockWorkspaceAgent : WorkspaceAgent = {
132
+ export const MockWorkspaceAgent : TypesGen . WorkspaceAgent = {
133
+ architecture : "amd64" ,
134
+ created_at : "" ,
135
+ environment_variables : { } ,
117
136
id : "test-workspace-agent" ,
118
137
name : "a-workspace-agent" ,
119
138
operating_system : "linux" ,
139
+ resource_id : "" ,
140
+ status : "connected" ,
141
+ updated_at : "" ,
120
142
}
121
143
122
- export const MockWorkspaceResource : WorkspaceResource = {
123
- id : "test-workspace-resource" ,
144
+ export const MockWorkspaceResource : TypesGen . WorkspaceResource = {
124
145
agents : [ MockWorkspaceAgent ] ,
146
+ created_at : "" ,
147
+ id : "test-workspace-resource" ,
148
+ job_id : "" ,
149
+ name : "a-workspace-resource" ,
150
+ type : "google_compute_disk" ,
151
+ workspace_transition : "start" ,
125
152
}
126
153
127
- export const MockUserAgent : UserAgent = {
154
+ export const MockUserAgent : Types . UserAgent = {
128
155
browser : "Chrome 99.0.4844" ,
129
156
device : "Other" ,
130
157
ip_address : "11.22.33.44" ,
131
158
os : "Windows 10" ,
132
159
}
133
160
134
- export const MockAuthMethods : AuthMethods = {
161
+ export const MockAuthMethods : TypesGen . AuthMethods = {
135
162
password : true ,
136
163
github : false ,
137
164
}
0 commit comments