@budibase/worker 2.22.3 → 2.22.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.22.3",
4
+ "version": "2.22.4",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -37,10 +37,10 @@
37
37
  "author": "Budibase",
38
38
  "license": "GPL-3.0",
39
39
  "dependencies": {
40
- "@budibase/backend-core": "2.22.3",
41
- "@budibase/pro": "2.22.3",
42
- "@budibase/string-templates": "2.22.3",
43
- "@budibase/types": "2.22.3",
40
+ "@budibase/backend-core": "2.22.4",
41
+ "@budibase/pro": "2.22.4",
42
+ "@budibase/string-templates": "2.22.4",
43
+ "@budibase/types": "2.22.4",
44
44
  "@koa/router": "8.0.8",
45
45
  "@techpass/passport-openidconnect": "0.3.2",
46
46
  "@types/global-agent": "2.1.1",
@@ -108,5 +108,5 @@
108
108
  }
109
109
  }
110
110
  },
111
- "gitHead": "32b6d3bf3eec3ac42d428c543669d62a35e9ad62"
111
+ "gitHead": "be7e99f7fdb36262e4a90563edad1ed53ec4e55e"
112
112
  }
@@ -58,7 +58,7 @@ describe("/api/global/auth", () => {
58
58
  const response = await config.api.auth.login(tenantId, email, password)
59
59
 
60
60
  expectSetAuthCookie(response)
61
- expect(events.auth.login).toBeCalledTimes(1)
61
+ expect(events.auth.login).toHaveBeenCalledTimes(1)
62
62
  })
63
63
 
64
64
  it("should return 403 with incorrect credentials", async () => {
@@ -139,7 +139,7 @@ describe("/api/global/auth", () => {
139
139
  describe("POST /api/global/auth/logout", () => {
140
140
  it("should logout", async () => {
141
141
  const response = await config.api.auth.logout()
142
- expect(events.auth.logout).toBeCalledTimes(1)
142
+ expect(events.auth.logout).toHaveBeenCalledTimes(1)
143
143
 
144
144
  const authCookie = getAuthCookie(response)
145
145
  expect(authCookie).toBe("")
@@ -160,8 +160,8 @@ describe("/api/global/auth", () => {
160
160
  })
161
161
  expect(sendMailMock).toHaveBeenCalled()
162
162
  expect(code).toBeDefined()
163
- expect(events.user.passwordResetRequested).toBeCalledTimes(1)
164
- expect(events.user.passwordResetRequested).toBeCalledWith(user)
163
+ expect(events.user.passwordResetRequested).toHaveBeenCalledTimes(1)
164
+ expect(events.user.passwordResetRequested).toHaveBeenCalledWith(user)
165
165
  })
166
166
 
167
167
  describe("sso user", () => {
@@ -211,8 +211,8 @@ describe("/api/global/auth", () => {
211
211
  delete user.password
212
212
 
213
213
  expect(res.body).toEqual({ message: "password reset successfully." })
214
- expect(events.user.passwordReset).toBeCalledTimes(1)
215
- expect(events.user.passwordReset).toBeCalledWith(user)
214
+ expect(events.user.passwordReset).toHaveBeenCalledTimes(1)
215
+ expect(events.user.passwordReset).toHaveBeenCalledWith(user)
216
216
 
217
217
  // login using new password
218
218
  await config.api.auth.login(user.tenantId, user.email, newPassword)
@@ -360,21 +360,16 @@ describe("/api/global/auth", () => {
360
360
 
361
361
  const res = await config.api.configs.OIDCCallback(configId, preAuthRes)
362
362
 
363
- expect(events.auth.login).toBeCalledWith("oidc", "oauth@example.com")
364
- expect(events.auth.login).toBeCalledTimes(1)
363
+ expect(events.auth.login).toHaveBeenCalledWith(
364
+ "oidc",
365
+ "oauth@example.com"
366
+ )
367
+ expect(events.auth.login).toHaveBeenCalledTimes(1)
365
368
  expect(res.status).toBe(302)
366
369
  const location: string = res.get("location")
367
370
  expect(location).toBe("/")
368
371
  expectSetAuthCookie(res)
369
372
  })
370
373
  })
371
-
372
- // SINGLE TENANT
373
-
374
- describe("GET /api/global/auth/oidc/callback", () => {})
375
-
376
- describe("GET /api/global/auth/oidc/callback", () => {})
377
-
378
- describe("GET /api/admin/auth/oidc/callback", () => {})
379
374
  })
380
375
  })
@@ -57,20 +57,22 @@ describe("configs", () => {
57
57
  describe("create", () => {
58
58
  it("should create activated google config", async () => {
59
59
  await saveGoogleConfig()
60
- expect(events.auth.SSOCreated).toBeCalledTimes(1)
61
- expect(events.auth.SSOCreated).toBeCalledWith(ConfigType.GOOGLE)
62
- expect(events.auth.SSODeactivated).not.toBeCalled()
63
- expect(events.auth.SSOActivated).toBeCalledTimes(1)
64
- expect(events.auth.SSOActivated).toBeCalledWith(ConfigType.GOOGLE)
60
+ expect(events.auth.SSOCreated).toHaveBeenCalledTimes(1)
61
+ expect(events.auth.SSOCreated).toHaveBeenCalledWith(ConfigType.GOOGLE)
62
+ expect(events.auth.SSODeactivated).not.toHaveBeenCalled()
63
+ expect(events.auth.SSOActivated).toHaveBeenCalledTimes(1)
64
+ expect(events.auth.SSOActivated).toHaveBeenCalledWith(
65
+ ConfigType.GOOGLE
66
+ )
65
67
  await config.deleteConfig(ConfigType.GOOGLE)
66
68
  })
67
69
 
68
70
  it("should create deactivated google config", async () => {
69
71
  await saveGoogleConfig({ activated: false })
70
- expect(events.auth.SSOCreated).toBeCalledTimes(1)
71
- expect(events.auth.SSOCreated).toBeCalledWith(ConfigType.GOOGLE)
72
- expect(events.auth.SSOActivated).not.toBeCalled()
73
- expect(events.auth.SSODeactivated).not.toBeCalled()
72
+ expect(events.auth.SSOCreated).toHaveBeenCalledTimes(1)
73
+ expect(events.auth.SSOCreated).toHaveBeenCalledWith(ConfigType.GOOGLE)
74
+ expect(events.auth.SSOActivated).not.toHaveBeenCalled()
75
+ expect(events.auth.SSODeactivated).not.toHaveBeenCalled()
74
76
  await config.deleteConfig(ConfigType.GOOGLE)
75
77
  })
76
78
  })
@@ -84,11 +86,13 @@ describe("configs", () => {
84
86
  googleConf._id,
85
87
  googleConf._rev
86
88
  )
87
- expect(events.auth.SSOUpdated).toBeCalledTimes(1)
88
- expect(events.auth.SSOUpdated).toBeCalledWith(ConfigType.GOOGLE)
89
- expect(events.auth.SSOActivated).not.toBeCalled()
90
- expect(events.auth.SSODeactivated).toBeCalledTimes(1)
91
- expect(events.auth.SSODeactivated).toBeCalledWith(ConfigType.GOOGLE)
89
+ expect(events.auth.SSOUpdated).toHaveBeenCalledTimes(1)
90
+ expect(events.auth.SSOUpdated).toHaveBeenCalledWith(ConfigType.GOOGLE)
91
+ expect(events.auth.SSOActivated).not.toHaveBeenCalled()
92
+ expect(events.auth.SSODeactivated).toHaveBeenCalledTimes(1)
93
+ expect(events.auth.SSODeactivated).toHaveBeenCalledWith(
94
+ ConfigType.GOOGLE
95
+ )
92
96
  await config.deleteConfig(ConfigType.GOOGLE)
93
97
  })
94
98
 
@@ -100,11 +104,13 @@ describe("configs", () => {
100
104
  googleConf._id,
101
105
  googleConf._rev
102
106
  )
103
- expect(events.auth.SSOUpdated).toBeCalledTimes(1)
104
- expect(events.auth.SSOUpdated).toBeCalledWith(ConfigType.GOOGLE)
105
- expect(events.auth.SSODeactivated).not.toBeCalled()
106
- expect(events.auth.SSOActivated).toBeCalledTimes(1)
107
- expect(events.auth.SSOActivated).toBeCalledWith(ConfigType.GOOGLE)
107
+ expect(events.auth.SSOUpdated).toHaveBeenCalledTimes(1)
108
+ expect(events.auth.SSOUpdated).toHaveBeenCalledWith(ConfigType.GOOGLE)
109
+ expect(events.auth.SSODeactivated).not.toHaveBeenCalled()
110
+ expect(events.auth.SSOActivated).toHaveBeenCalledTimes(1)
111
+ expect(events.auth.SSOActivated).toHaveBeenCalledWith(
112
+ ConfigType.GOOGLE
113
+ )
108
114
  await config.deleteConfig(ConfigType.GOOGLE)
109
115
  })
110
116
  })
@@ -123,20 +129,20 @@ describe("configs", () => {
123
129
  describe("create", () => {
124
130
  it("should create activated OIDC config", async () => {
125
131
  await saveOIDCConfig()
126
- expect(events.auth.SSOCreated).toBeCalledTimes(1)
127
- expect(events.auth.SSOCreated).toBeCalledWith(ConfigType.OIDC)
128
- expect(events.auth.SSODeactivated).not.toBeCalled()
129
- expect(events.auth.SSOActivated).toBeCalledTimes(1)
130
- expect(events.auth.SSOActivated).toBeCalledWith(ConfigType.OIDC)
132
+ expect(events.auth.SSOCreated).toHaveBeenCalledTimes(1)
133
+ expect(events.auth.SSOCreated).toHaveBeenCalledWith(ConfigType.OIDC)
134
+ expect(events.auth.SSODeactivated).not.toHaveBeenCalled()
135
+ expect(events.auth.SSOActivated).toHaveBeenCalledTimes(1)
136
+ expect(events.auth.SSOActivated).toHaveBeenCalledWith(ConfigType.OIDC)
131
137
  await config.deleteConfig(ConfigType.OIDC)
132
138
  })
133
139
 
134
140
  it("should create deactivated OIDC config", async () => {
135
141
  await saveOIDCConfig({ activated: false })
136
- expect(events.auth.SSOCreated).toBeCalledTimes(1)
137
- expect(events.auth.SSOCreated).toBeCalledWith(ConfigType.OIDC)
138
- expect(events.auth.SSOActivated).not.toBeCalled()
139
- expect(events.auth.SSODeactivated).not.toBeCalled()
142
+ expect(events.auth.SSOCreated).toHaveBeenCalledTimes(1)
143
+ expect(events.auth.SSOCreated).toHaveBeenCalledWith(ConfigType.OIDC)
144
+ expect(events.auth.SSOActivated).not.toHaveBeenCalled()
145
+ expect(events.auth.SSODeactivated).not.toHaveBeenCalled()
140
146
  await config.deleteConfig(ConfigType.OIDC)
141
147
  })
142
148
  })
@@ -150,11 +156,13 @@ describe("configs", () => {
150
156
  oidcConf._id,
151
157
  oidcConf._rev
152
158
  )
153
- expect(events.auth.SSOUpdated).toBeCalledTimes(1)
154
- expect(events.auth.SSOUpdated).toBeCalledWith(ConfigType.OIDC)
155
- expect(events.auth.SSOActivated).not.toBeCalled()
156
- expect(events.auth.SSODeactivated).toBeCalledTimes(1)
157
- expect(events.auth.SSODeactivated).toBeCalledWith(ConfigType.OIDC)
159
+ expect(events.auth.SSOUpdated).toHaveBeenCalledTimes(1)
160
+ expect(events.auth.SSOUpdated).toHaveBeenCalledWith(ConfigType.OIDC)
161
+ expect(events.auth.SSOActivated).not.toHaveBeenCalled()
162
+ expect(events.auth.SSODeactivated).toHaveBeenCalledTimes(1)
163
+ expect(events.auth.SSODeactivated).toHaveBeenCalledWith(
164
+ ConfigType.OIDC
165
+ )
158
166
  await config.deleteConfig(ConfigType.OIDC)
159
167
  })
160
168
 
@@ -166,11 +174,11 @@ describe("configs", () => {
166
174
  oidcConf._id,
167
175
  oidcConf._rev
168
176
  )
169
- expect(events.auth.SSOUpdated).toBeCalledTimes(1)
170
- expect(events.auth.SSOUpdated).toBeCalledWith(ConfigType.OIDC)
171
- expect(events.auth.SSODeactivated).not.toBeCalled()
172
- expect(events.auth.SSOActivated).toBeCalledTimes(1)
173
- expect(events.auth.SSOActivated).toBeCalledWith(ConfigType.OIDC)
177
+ expect(events.auth.SSOUpdated).toHaveBeenCalledTimes(1)
178
+ expect(events.auth.SSOUpdated).toHaveBeenCalledWith(ConfigType.OIDC)
179
+ expect(events.auth.SSODeactivated).not.toHaveBeenCalled()
180
+ expect(events.auth.SSOActivated).toHaveBeenCalledTimes(1)
181
+ expect(events.auth.SSOActivated).toHaveBeenCalledWith(ConfigType.OIDC)
174
182
  await config.deleteConfig(ConfigType.OIDC)
175
183
  })
176
184
  })
@@ -190,8 +198,8 @@ describe("configs", () => {
190
198
  it("should create SMTP config", async () => {
191
199
  await config.deleteConfig(ConfigType.SMTP)
192
200
  await saveSMTPConfig()
193
- expect(events.email.SMTPUpdated).not.toBeCalled()
194
- expect(events.email.SMTPCreated).toBeCalledTimes(1)
201
+ expect(events.email.SMTPUpdated).not.toHaveBeenCalled()
202
+ expect(events.email.SMTPCreated).toHaveBeenCalledTimes(1)
195
203
  await config.deleteConfig(ConfigType.SMTP)
196
204
  })
197
205
  })
@@ -201,8 +209,8 @@ describe("configs", () => {
201
209
  const smtpConf = await saveSMTPConfig()
202
210
  jest.clearAllMocks()
203
211
  await saveSMTPConfig(smtpConf.config, smtpConf._id, smtpConf._rev)
204
- expect(events.email.SMTPCreated).not.toBeCalled()
205
- expect(events.email.SMTPUpdated).toBeCalledTimes(1)
212
+ expect(events.email.SMTPCreated).not.toHaveBeenCalled()
213
+ expect(events.email.SMTPUpdated).toHaveBeenCalledTimes(1)
206
214
  await config.deleteConfig(ConfigType.SMTP)
207
215
  })
208
216
  })
@@ -215,9 +223,9 @@ describe("configs", () => {
215
223
 
216
224
  await saveSettingsConfig()
217
225
 
218
- expect(events.org.nameUpdated).not.toBeCalled()
219
- expect(events.org.logoUpdated).not.toBeCalled()
220
- expect(events.org.platformURLUpdated).not.toBeCalled()
226
+ expect(events.org.nameUpdated).not.toHaveBeenCalled()
227
+ expect(events.org.logoUpdated).not.toHaveBeenCalled()
228
+ expect(events.org.platformURLUpdated).not.toHaveBeenCalled()
221
229
  })
222
230
 
223
231
  it("should create settings config with non-default settings", async () => {
@@ -231,9 +239,9 @@ describe("configs", () => {
231
239
 
232
240
  await saveSettingsConfig(conf)
233
241
 
234
- expect(events.org.nameUpdated).toBeCalledTimes(1)
235
- expect(events.org.logoUpdated).toBeCalledTimes(1)
236
- expect(events.org.platformURLUpdated).toBeCalledTimes(1)
242
+ expect(events.org.nameUpdated).toHaveBeenCalledTimes(1)
243
+ expect(events.org.logoUpdated).toHaveBeenCalledTimes(1)
244
+ expect(events.org.platformURLUpdated).toHaveBeenCalledTimes(1)
237
245
  config.cloudHosted()
238
246
  })
239
247
  })
@@ -253,9 +261,9 @@ describe("configs", () => {
253
261
  settingsConfig._rev
254
262
  )
255
263
 
256
- expect(events.org.nameUpdated).toBeCalledTimes(1)
257
- expect(events.org.logoUpdated).toBeCalledTimes(1)
258
- expect(events.org.platformURLUpdated).toBeCalledTimes(1)
264
+ expect(events.org.nameUpdated).toHaveBeenCalledTimes(1)
265
+ expect(events.org.logoUpdated).toHaveBeenCalledTimes(1)
266
+ expect(events.org.platformURLUpdated).toHaveBeenCalledTimes(1)
259
267
  config.cloudHosted()
260
268
  })
261
269
  })
@@ -25,9 +25,9 @@ describe("/api/global/groups", () => {
25
25
  it("should be able to create a new group", async () => {
26
26
  const group = structures.groups.UserGroup()
27
27
  await config.api.groups.saveGroup(group)
28
- expect(events.group.created).toBeCalledTimes(1)
29
- expect(events.group.updated).not.toBeCalled()
30
- expect(events.group.permissionsEdited).not.toBeCalled()
28
+ expect(events.group.created).toHaveBeenCalledTimes(1)
29
+ expect(events.group.updated).not.toHaveBeenCalled()
30
+ expect(events.group.permissionsEdited).not.toHaveBeenCalled()
31
31
  })
32
32
 
33
33
  it("should not allow undefined names", async () => {
@@ -57,7 +57,7 @@ describe("/api/global/groups", () => {
57
57
  it("should trim names", async () => {
58
58
  const group = { ...structures.groups.UserGroup(), name: " group name " }
59
59
  await config.api.groups.saveGroup(group)
60
- expect(events.group.created).toBeCalledWith(
60
+ expect(events.group.created).toHaveBeenCalledWith(
61
61
  expect.objectContaining({ name: "group name" })
62
62
  )
63
63
  })
@@ -100,8 +100,8 @@ describe("/api/global/groups", () => {
100
100
  }
101
101
  await config.api.groups.saveGroup(updatedGroup)
102
102
 
103
- expect(events.group.updated).toBeCalledTimes(1)
104
- expect(events.group.permissionsEdited).not.toBeCalled()
103
+ expect(events.group.updated).toHaveBeenCalledTimes(1)
104
+ expect(events.group.permissionsEdited).not.toHaveBeenCalled()
105
105
  })
106
106
 
107
107
  describe("scim", () => {
@@ -135,7 +135,7 @@ describe("/api/global/groups", () => {
135
135
  },
136
136
  })
137
137
 
138
- expect(events.group.updated).not.toBeCalled()
138
+ expect(events.group.updated).not.toHaveBeenCalled()
139
139
  })
140
140
 
141
141
  it("update will not amend the SCIM fields", async () => {
@@ -151,7 +151,7 @@ describe("/api/global/groups", () => {
151
151
  expect: 200,
152
152
  })
153
153
 
154
- expect(events.group.updated).toBeCalledTimes(1)
154
+ expect(events.group.updated).toHaveBeenCalledTimes(1)
155
155
  expect(
156
156
  (
157
157
  await config.api.groups.find(group._id!, {
@@ -176,7 +176,7 @@ describe("/api/global/groups", () => {
176
176
  let oldGroup = await config.api.groups.saveGroup(group)
177
177
  await config.api.groups.deleteGroup(oldGroup.body._id, oldGroup.body._rev)
178
178
 
179
- expect(events.group.deleted).toBeCalledTimes(1)
179
+ expect(events.group.deleted).toHaveBeenCalledTimes(1)
180
180
  })
181
181
  })
182
182
 
@@ -22,7 +22,7 @@ describe("/api/global/license", () => {
22
22
  it("returns 200", async () => {
23
23
  const res = await config.api.license.refresh()
24
24
  expect(res.status).toBe(200)
25
- expect(licensing.cache.refresh).toBeCalledTimes(1)
25
+ expect(licensing.cache.refresh).toHaveBeenCalledTimes(1)
26
26
  })
27
27
  })
28
28
 
@@ -42,7 +42,9 @@ describe("/api/global/license", () => {
42
42
  licenseKey: "licenseKey",
43
43
  })
44
44
  expect(res.status).toBe(200)
45
- expect(licensing.keys.activateLicenseKey).toBeCalledWith("licenseKey")
45
+ expect(licensing.keys.activateLicenseKey).toHaveBeenCalledWith(
46
+ "licenseKey"
47
+ )
46
48
  })
47
49
  })
48
50
 
@@ -64,7 +66,7 @@ describe("/api/global/license", () => {
64
66
  describe("DELETE /api/global/license/key", () => {
65
67
  it("returns 204", async () => {
66
68
  const res = await config.api.license.deleteLicenseKey()
67
- expect(licensing.keys.deleteLicenseKey).toBeCalledTimes(1)
69
+ expect(licensing.keys.deleteLicenseKey).toHaveBeenCalledTimes(1)
68
70
  expect(res.status).toBe(204)
69
71
  })
70
72
  })
@@ -74,9 +76,9 @@ describe("/api/global/license", () => {
74
76
  const res = await config.api.license.activateOfflineLicense({
75
77
  offlineLicenseToken: "offlineLicenseToken",
76
78
  })
77
- expect(licensing.offline.activateOfflineLicenseToken).toBeCalledWith(
78
- "offlineLicenseToken"
79
- )
79
+ expect(
80
+ licensing.offline.activateOfflineLicenseToken
81
+ ).toHaveBeenCalledWith("offlineLicenseToken")
80
82
  expect(res.status).toBe(200)
81
83
  })
82
84
  })
@@ -102,7 +104,9 @@ describe("/api/global/license", () => {
102
104
  it("returns 204", async () => {
103
105
  const res = await config.api.license.deleteOfflineLicense()
104
106
  expect(res.status).toBe(204)
105
- expect(licensing.offline.deleteOfflineLicenseToken).toBeCalledTimes(1)
107
+ expect(licensing.offline.deleteOfflineLicenseToken).toHaveBeenCalledTimes(
108
+ 1
109
+ )
106
110
  })
107
111
  })
108
112
 
@@ -43,7 +43,6 @@ describe("/api/global/email", () => {
43
43
  }
44
44
  expect(res.body.message).toBeDefined()
45
45
  const testUrl = nodemailer.getTestMessageUrl(res.body)
46
- console.log(`${purpose} URL: ${testUrl}`)
47
46
  expect(testUrl).toBeDefined()
48
47
  response = await fetch(testUrl)
49
48
  text = await response.text()
@@ -304,7 +304,7 @@ describe("scim", () => {
304
304
 
305
305
  await postScimUser({ body })
306
306
 
307
- expect(events.user.created).toBeCalledTimes(1)
307
+ expect(events.user.created).toHaveBeenCalledTimes(1)
308
308
  })
309
309
 
310
310
  it("if the username is an email, the user name will be used as email", async () => {
@@ -571,7 +571,7 @@ describe("scim", () => {
571
571
 
572
572
  await patchScimUser({ id: user.id, body })
573
573
 
574
- expect(events.user.updated).toBeCalledTimes(1)
574
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
575
575
  })
576
576
  })
577
577
 
@@ -603,7 +603,7 @@ describe("scim", () => {
603
603
  it("an event is dispatched", async () => {
604
604
  await deleteScimUser(user.id, { expect: 204 })
605
605
 
606
- expect(events.user.deleted).toBeCalledTimes(1)
606
+ expect(events.user.deleted).toHaveBeenCalledTimes(1)
607
607
  })
608
608
 
609
609
  it("an account holder cannot be removed even when synched", async () => {
@@ -41,10 +41,10 @@ describe("/api/global/self", () => {
41
41
  user._rev = dbUser._rev
42
42
  user.dayPassRecordedAt = mocks.date.MOCK_DATE.toISOString()
43
43
  expect(res.body._id).toBe(user._id)
44
- expect(events.user.updated).toBeCalledTimes(1)
45
- expect(events.user.updated).toBeCalledWith(dbUser)
46
- expect(events.user.passwordUpdated).toBeCalledTimes(1)
47
- expect(events.user.passwordUpdated).toBeCalledWith(dbUser)
44
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
45
+ expect(events.user.updated).toHaveBeenCalledWith(dbUser)
46
+ expect(events.user.passwordUpdated).toHaveBeenCalledTimes(1)
47
+ expect(events.user.passwordUpdated).toHaveBeenCalledWith(dbUser)
48
48
  })
49
49
  })
50
50
 
@@ -39,7 +39,7 @@ describe("/api/global/users", () => {
39
39
 
40
40
  expect(sendMailMock).toHaveBeenCalled()
41
41
  expect(code).toBeDefined()
42
- expect(events.user.invited).toBeCalledTimes(1)
42
+ expect(events.user.invited).toHaveBeenCalledTimes(1)
43
43
  })
44
44
 
45
45
  it("should not be able to generate an invitation for existing user", async () => {
@@ -52,7 +52,7 @@ describe("/api/global/users", () => {
52
52
  expect(res.body.message).toBe(`Unavailable`)
53
53
  expect(sendMailMock).toHaveBeenCalledTimes(0)
54
54
  expect(code).toBeUndefined()
55
- expect(events.user.invited).toBeCalledTimes(0)
55
+ expect(events.user.invited).toHaveBeenCalledTimes(0)
56
56
  })
57
57
 
58
58
  it("should not invite the same user twice", async () => {
@@ -70,7 +70,7 @@ describe("/api/global/users", () => {
70
70
  expect(res.body.message).toBe(`Unavailable`)
71
71
  expect(sendMailMock).toHaveBeenCalledTimes(0)
72
72
  expect(code).toBeUndefined()
73
- expect(events.user.invited).toBeCalledTimes(0)
73
+ expect(events.user.invited).toHaveBeenCalledTimes(0)
74
74
  })
75
75
 
76
76
  it("should be able to create new user from invite", async () => {
@@ -86,8 +86,8 @@ describe("/api/global/users", () => {
86
86
  const user = await config.getUser(email)
87
87
  expect(user).toBeDefined()
88
88
  expect(user!._id).toEqual(res.body._id)
89
- expect(events.user.inviteAccepted).toBeCalledTimes(1)
90
- expect(events.user.inviteAccepted).toBeCalledWith(user)
89
+ expect(events.user.inviteAccepted).toHaveBeenCalledTimes(1)
90
+ expect(events.user.inviteAccepted).toHaveBeenCalledWith(user)
91
91
  })
92
92
  })
93
93
 
@@ -105,7 +105,7 @@ describe("/api/global/users", () => {
105
105
  expect(body.successful.length).toBe(2)
106
106
  expect(body.unsuccessful.length).toBe(0)
107
107
  expect(sendMailMock).toHaveBeenCalledTimes(2)
108
- expect(events.user.invited).toBeCalledTimes(2)
108
+ expect(events.user.invited).toHaveBeenCalledTimes(2)
109
109
  })
110
110
 
111
111
  it("should not be able to generate an invitation for existing user", async () => {
@@ -118,7 +118,7 @@ describe("/api/global/users", () => {
118
118
  expect(body.unsuccessful.length).toBe(1)
119
119
  expect(body.unsuccessful[0].reason).toBe("Unavailable")
120
120
  expect(sendMailMock).toHaveBeenCalledTimes(0)
121
- expect(events.user.invited).toBeCalledTimes(0)
121
+ expect(events.user.invited).toHaveBeenCalledTimes(0)
122
122
  })
123
123
 
124
124
  it("should not be able to generate an invitation for user that has already been invited", async () => {
@@ -135,7 +135,7 @@ describe("/api/global/users", () => {
135
135
  expect(body.unsuccessful.length).toBe(1)
136
136
  expect(body.unsuccessful[0].reason).toBe("Unavailable")
137
137
  expect(sendMailMock).toHaveBeenCalledTimes(0)
138
- expect(events.user.invited).toBeCalledTimes(0)
138
+ expect(events.user.invited).toHaveBeenCalledTimes(0)
139
139
  })
140
140
  })
141
141
 
@@ -149,7 +149,7 @@ describe("/api/global/users", () => {
149
149
  expect(response.created?.successful.length).toBe(0)
150
150
  expect(response.created?.unsuccessful.length).toBe(1)
151
151
  expect(response.created?.unsuccessful[0].email).toBe(user.email)
152
- expect(events.user.created).toBeCalledTimes(0)
152
+ expect(events.user.created).toHaveBeenCalledTimes(0)
153
153
  })
154
154
 
155
155
  it("should ignore users existing in other tenants", async () => {
@@ -162,7 +162,7 @@ describe("/api/global/users", () => {
162
162
  expect(response.created?.successful.length).toBe(0)
163
163
  expect(response.created?.unsuccessful.length).toBe(1)
164
164
  expect(response.created?.unsuccessful[0].email).toBe(user.email)
165
- expect(events.user.created).toBeCalledTimes(0)
165
+ expect(events.user.created).toHaveBeenCalledTimes(0)
166
166
  })
167
167
  })
168
168
 
@@ -177,7 +177,7 @@ describe("/api/global/users", () => {
177
177
  expect(response.created?.successful.length).toBe(0)
178
178
  expect(response.created?.unsuccessful.length).toBe(1)
179
179
  expect(response.created?.unsuccessful[0].email).toBe(user.email)
180
- expect(events.user.created).toBeCalledTimes(0)
180
+ expect(events.user.created).toHaveBeenCalledTimes(0)
181
181
  })
182
182
 
183
183
  it("should be able to bulk create users", async () => {
@@ -196,9 +196,9 @@ describe("/api/global/users", () => {
196
196
  expect(response.created?.successful[1].email).toBe(admin.email)
197
197
  expect(response.created?.successful[2].email).toBe(user.email)
198
198
  expect(response.created?.unsuccessful.length).toBe(0)
199
- expect(events.user.created).toBeCalledTimes(3)
200
- expect(events.user.permissionAdminAssigned).toBeCalledTimes(1)
201
- expect(events.user.permissionBuilderAssigned).toBeCalledTimes(2)
199
+ expect(events.user.created).toHaveBeenCalledTimes(3)
200
+ expect(events.user.permissionAdminAssigned).toHaveBeenCalledTimes(1)
201
+ expect(events.user.permissionBuilderAssigned).toHaveBeenCalledTimes(2)
202
202
  })
203
203
  })
204
204
 
@@ -208,10 +208,10 @@ describe("/api/global/users", () => {
208
208
 
209
209
  await config.api.users.saveUser(user)
210
210
 
211
- expect(events.user.created).toBeCalledTimes(1)
212
- expect(events.user.updated).not.toBeCalled()
213
- expect(events.user.permissionBuilderAssigned).not.toBeCalled()
214
- expect(events.user.permissionAdminAssigned).not.toBeCalled()
211
+ expect(events.user.created).toHaveBeenCalledTimes(1)
212
+ expect(events.user.updated).not.toHaveBeenCalled()
213
+ expect(events.user.permissionBuilderAssigned).not.toHaveBeenCalled()
214
+ expect(events.user.permissionAdminAssigned).not.toHaveBeenCalled()
215
215
  })
216
216
 
217
217
  it("should be able to create an admin user", async () => {
@@ -219,10 +219,10 @@ describe("/api/global/users", () => {
219
219
 
220
220
  await config.api.users.saveUser(user)
221
221
 
222
- expect(events.user.created).toBeCalledTimes(1)
223
- expect(events.user.updated).not.toBeCalled()
224
- expect(events.user.permissionBuilderAssigned).toBeCalledTimes(1)
225
- expect(events.user.permissionAdminAssigned).toBeCalledTimes(1)
222
+ expect(events.user.created).toHaveBeenCalledTimes(1)
223
+ expect(events.user.updated).not.toHaveBeenCalled()
224
+ expect(events.user.permissionBuilderAssigned).toHaveBeenCalledTimes(1)
225
+ expect(events.user.permissionAdminAssigned).toHaveBeenCalledTimes(1)
226
226
  })
227
227
 
228
228
  it("should be able to create a builder user", async () => {
@@ -230,10 +230,10 @@ describe("/api/global/users", () => {
230
230
 
231
231
  await config.api.users.saveUser(user)
232
232
 
233
- expect(events.user.created).toBeCalledTimes(1)
234
- expect(events.user.updated).not.toBeCalled()
235
- expect(events.user.permissionBuilderAssigned).toBeCalledTimes(1)
236
- expect(events.user.permissionAdminAssigned).not.toBeCalled()
233
+ expect(events.user.created).toHaveBeenCalledTimes(1)
234
+ expect(events.user.updated).not.toHaveBeenCalled()
235
+ expect(events.user.permissionBuilderAssigned).toHaveBeenCalledTimes(1)
236
+ expect(events.user.permissionAdminAssigned).not.toHaveBeenCalled()
237
237
  })
238
238
 
239
239
  it("should be able to assign app roles", async () => {
@@ -246,11 +246,11 @@ describe("/api/global/users", () => {
246
246
  await config.api.users.saveUser(user)
247
247
 
248
248
  const savedUser = await config.getUser(user.email)
249
- expect(events.user.created).toBeCalledTimes(1)
250
- expect(events.user.updated).not.toBeCalled()
251
- expect(events.role.assigned).toBeCalledTimes(2)
252
- expect(events.role.assigned).toBeCalledWith(savedUser, "role1")
253
- expect(events.role.assigned).toBeCalledWith(savedUser, "role2")
249
+ expect(events.user.created).toHaveBeenCalledTimes(1)
250
+ expect(events.user.updated).not.toHaveBeenCalled()
251
+ expect(events.role.assigned).toHaveBeenCalledTimes(2)
252
+ expect(events.role.assigned).toHaveBeenCalledWith(savedUser, "role1")
253
+ expect(events.role.assigned).toHaveBeenCalledWith(savedUser, "role2")
254
254
  })
255
255
 
256
256
  it("should not be able to create user that exists in same tenant", async () => {
@@ -264,7 +264,7 @@ describe("/api/global/users", () => {
264
264
  expect(response.body.message).toBe(
265
265
  `Email already in use: '${user.email}'`
266
266
  )
267
- expect(events.user.created).toBeCalledTimes(0)
267
+ expect(events.user.created).toHaveBeenCalledTimes(0)
268
268
  })
269
269
 
270
270
  it("should not be able to create user that exists in other tenant", async () => {
@@ -278,7 +278,7 @@ describe("/api/global/users", () => {
278
278
  expect(response.body.message).toBe(
279
279
  `Email already in use: '${user.email}'`
280
280
  )
281
- expect(events.user.created).toBeCalledTimes(0)
281
+ expect(events.user.created).toHaveBeenCalledTimes(0)
282
282
  })
283
283
  })
284
284
 
@@ -292,7 +292,7 @@ describe("/api/global/users", () => {
292
292
  expect(response.body.message).toBe(
293
293
  `Email already in use: '${user.email}'`
294
294
  )
295
- expect(events.user.created).toBeCalledTimes(0)
295
+ expect(events.user.created).toHaveBeenCalledTimes(0)
296
296
  })
297
297
 
298
298
  it("should not be able to create a user with the same email and different casing", async () => {
@@ -302,7 +302,7 @@ describe("/api/global/users", () => {
302
302
  user.email = user.email.toUpperCase()
303
303
  await config.api.users.saveUser(user, 400)
304
304
 
305
- expect(events.user.created).toBeCalledTimes(1)
305
+ expect(events.user.created).toHaveBeenCalledTimes(1)
306
306
  })
307
307
 
308
308
  it("should not be able to bulk create a user with the same email and different casing", async () => {
@@ -312,7 +312,7 @@ describe("/api/global/users", () => {
312
312
  user.email = user.email.toUpperCase()
313
313
  await config.api.users.bulkCreateUsers([user])
314
314
 
315
- expect(events.user.created).toBeCalledTimes(1)
315
+ expect(events.user.created).toHaveBeenCalledTimes(1)
316
316
  })
317
317
 
318
318
  it("should not allow a non-admin user to create a new user", async () => {
@@ -335,11 +335,11 @@ describe("/api/global/users", () => {
335
335
 
336
336
  await config.api.users.saveUser(user)
337
337
 
338
- expect(events.user.created).not.toBeCalled()
339
- expect(events.user.updated).toBeCalledTimes(1)
340
- expect(events.user.permissionBuilderAssigned).not.toBeCalled()
341
- expect(events.user.permissionAdminAssigned).not.toBeCalled()
342
- expect(events.user.passwordForceReset).not.toBeCalled()
338
+ expect(events.user.created).not.toHaveBeenCalled()
339
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
340
+ expect(events.user.permissionBuilderAssigned).not.toHaveBeenCalled()
341
+ expect(events.user.permissionAdminAssigned).not.toHaveBeenCalled()
342
+ expect(events.user.passwordForceReset).not.toHaveBeenCalled()
343
343
  })
344
344
 
345
345
  it("should not allow a user to update their own admin/builder status", async () => {
@@ -367,11 +367,11 @@ describe("/api/global/users", () => {
367
367
  user.password = "tempPassword"
368
368
  await config.api.users.saveUser(user)
369
369
 
370
- expect(events.user.created).not.toBeCalled()
371
- expect(events.user.updated).toBeCalledTimes(1)
372
- expect(events.user.permissionBuilderAssigned).not.toBeCalled()
373
- expect(events.user.permissionAdminAssigned).not.toBeCalled()
374
- expect(events.user.passwordForceReset).toBeCalledTimes(1)
370
+ expect(events.user.created).not.toHaveBeenCalled()
371
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
372
+ expect(events.user.permissionBuilderAssigned).not.toHaveBeenCalled()
373
+ expect(events.user.permissionAdminAssigned).not.toHaveBeenCalled()
374
+ expect(events.user.passwordForceReset).toHaveBeenCalledTimes(1)
375
375
  })
376
376
 
377
377
  it("should be able to update a basic user to an admin user", async () => {
@@ -380,10 +380,10 @@ describe("/api/global/users", () => {
380
380
 
381
381
  await config.api.users.saveUser(structures.users.adminUser(user))
382
382
 
383
- expect(events.user.created).not.toBeCalled()
384
- expect(events.user.updated).toBeCalledTimes(1)
385
- expect(events.user.permissionBuilderAssigned).toBeCalledTimes(1)
386
- expect(events.user.permissionAdminAssigned).toBeCalledTimes(1)
383
+ expect(events.user.created).not.toHaveBeenCalled()
384
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
385
+ expect(events.user.permissionBuilderAssigned).toHaveBeenCalledTimes(1)
386
+ expect(events.user.permissionAdminAssigned).toHaveBeenCalledTimes(1)
387
387
  })
388
388
 
389
389
  it("should be able to update a basic user to a builder user", async () => {
@@ -392,10 +392,10 @@ describe("/api/global/users", () => {
392
392
 
393
393
  await config.api.users.saveUser(structures.users.builderUser(user))
394
394
 
395
- expect(events.user.created).not.toBeCalled()
396
- expect(events.user.updated).toBeCalledTimes(1)
397
- expect(events.user.permissionBuilderAssigned).toBeCalledTimes(1)
398
- expect(events.user.permissionAdminAssigned).not.toBeCalled()
395
+ expect(events.user.created).not.toHaveBeenCalled()
396
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
397
+ expect(events.user.permissionBuilderAssigned).toHaveBeenCalledTimes(1)
398
+ expect(events.user.permissionAdminAssigned).not.toHaveBeenCalled()
399
399
  })
400
400
 
401
401
  it("should be able to update an admin user to a basic user", async () => {
@@ -406,10 +406,10 @@ describe("/api/global/users", () => {
406
406
 
407
407
  await config.api.users.saveUser(user)
408
408
 
409
- expect(events.user.created).not.toBeCalled()
410
- expect(events.user.updated).toBeCalledTimes(1)
411
- expect(events.user.permissionAdminRemoved).toBeCalledTimes(1)
412
- expect(events.user.permissionBuilderRemoved).toBeCalledTimes(1)
409
+ expect(events.user.created).not.toHaveBeenCalled()
410
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
411
+ expect(events.user.permissionAdminRemoved).toHaveBeenCalledTimes(1)
412
+ expect(events.user.permissionBuilderRemoved).toHaveBeenCalledTimes(1)
413
413
  })
414
414
 
415
415
  it("should be able to update an builder user to a basic user", async () => {
@@ -419,10 +419,10 @@ describe("/api/global/users", () => {
419
419
 
420
420
  await config.api.users.saveUser(user)
421
421
 
422
- expect(events.user.created).not.toBeCalled()
423
- expect(events.user.updated).toBeCalledTimes(1)
424
- expect(events.user.permissionBuilderRemoved).toBeCalledTimes(1)
425
- expect(events.user.permissionAdminRemoved).not.toBeCalled()
422
+ expect(events.user.created).not.toHaveBeenCalled()
423
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
424
+ expect(events.user.permissionBuilderRemoved).toHaveBeenCalledTimes(1)
425
+ expect(events.user.permissionAdminRemoved).not.toHaveBeenCalled()
426
426
  })
427
427
 
428
428
  it("should be able to assign app roles", async () => {
@@ -436,11 +436,11 @@ describe("/api/global/users", () => {
436
436
  await config.api.users.saveUser(user)
437
437
 
438
438
  const savedUser = await config.getUser(user.email)
439
- expect(events.user.created).not.toBeCalled()
440
- expect(events.user.updated).toBeCalledTimes(1)
441
- expect(events.role.assigned).toBeCalledTimes(2)
442
- expect(events.role.assigned).toBeCalledWith(savedUser, "role1")
443
- expect(events.role.assigned).toBeCalledWith(savedUser, "role2")
439
+ expect(events.user.created).not.toHaveBeenCalled()
440
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
441
+ expect(events.role.assigned).toHaveBeenCalledTimes(2)
442
+ expect(events.role.assigned).toHaveBeenCalledWith(savedUser, "role1")
443
+ expect(events.role.assigned).toHaveBeenCalledWith(savedUser, "role2")
444
444
  })
445
445
 
446
446
  it("should be able to unassign app roles", async () => {
@@ -456,11 +456,11 @@ describe("/api/global/users", () => {
456
456
  await config.api.users.saveUser(user)
457
457
 
458
458
  const savedUser = await config.getUser(user.email)
459
- expect(events.user.created).not.toBeCalled()
460
- expect(events.user.updated).toBeCalledTimes(1)
461
- expect(events.role.unassigned).toBeCalledTimes(2)
462
- expect(events.role.unassigned).toBeCalledWith(savedUser, "role1")
463
- expect(events.role.unassigned).toBeCalledWith(savedUser, "role2")
459
+ expect(events.user.created).not.toHaveBeenCalled()
460
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
461
+ expect(events.role.unassigned).toHaveBeenCalledTimes(2)
462
+ expect(events.role.unassigned).toHaveBeenCalledWith(savedUser, "role1")
463
+ expect(events.role.unassigned).toHaveBeenCalledWith(savedUser, "role2")
464
464
  })
465
465
 
466
466
  it("should be able to update existing app roles", async () => {
@@ -479,12 +479,12 @@ describe("/api/global/users", () => {
479
479
  await config.api.users.saveUser(user)
480
480
 
481
481
  const savedUser = await config.getUser(user.email)
482
- expect(events.user.created).not.toBeCalled()
483
- expect(events.user.updated).toBeCalledTimes(1)
484
- expect(events.role.unassigned).toBeCalledTimes(1)
485
- expect(events.role.unassigned).toBeCalledWith(savedUser, "role2")
486
- expect(events.role.assigned).toBeCalledTimes(1)
487
- expect(events.role.assigned).toBeCalledWith(savedUser, "role2-edit")
482
+ expect(events.user.created).not.toHaveBeenCalled()
483
+ expect(events.user.updated).toHaveBeenCalledTimes(1)
484
+ expect(events.role.unassigned).toHaveBeenCalledTimes(1)
485
+ expect(events.role.unassigned).toHaveBeenCalledWith(savedUser, "role2")
486
+ expect(events.role.assigned).toHaveBeenCalledTimes(1)
487
+ expect(events.role.assigned).toHaveBeenCalledWith(savedUser, "role2-edit")
488
488
  })
489
489
 
490
490
  it("should not be able to update email address", async () => {
@@ -534,7 +534,7 @@ describe("/api/global/users", () => {
534
534
  const response = await config.api.users.bulkDeleteUsers([user._id!], 400)
535
535
 
536
536
  expect(response.message).toBe("Unable to delete self.")
537
- expect(events.user.deleted).not.toBeCalled()
537
+ expect(events.user.deleted).not.toHaveBeenCalled()
538
538
  })
539
539
 
540
540
  it("should not be able to bulk delete account owner", async () => {
@@ -551,7 +551,7 @@ describe("/api/global/users", () => {
551
551
  "Account holder cannot be deleted"
552
552
  )
553
553
  expect(response.deleted?.unsuccessful[0]._id).toBe(user._id)
554
- expect(events.user.deleted).not.toBeCalled()
554
+ expect(events.user.deleted).not.toHaveBeenCalled()
555
555
  })
556
556
 
557
557
  it("should be able to bulk delete users", async () => {
@@ -574,9 +574,9 @@ describe("/api/global/users", () => {
574
574
 
575
575
  expect(response.deleted?.successful.length).toBe(3)
576
576
  expect(response.deleted?.unsuccessful.length).toBe(0)
577
- expect(events.user.deleted).toBeCalledTimes(3)
578
- expect(events.user.permissionAdminRemoved).toBeCalledTimes(1)
579
- expect(events.user.permissionBuilderRemoved).toBeCalledTimes(2)
577
+ expect(events.user.deleted).toHaveBeenCalledTimes(3)
578
+ expect(events.user.permissionAdminRemoved).toHaveBeenCalledTimes(1)
579
+ expect(events.user.permissionBuilderRemoved).toHaveBeenCalledTimes(2)
580
580
  })
581
581
  })
582
582
 
@@ -669,9 +669,9 @@ describe("/api/global/users", () => {
669
669
 
670
670
  await config.api.users.deleteUser(user._id!)
671
671
 
672
- expect(events.user.deleted).toBeCalledTimes(1)
673
- expect(events.user.permissionBuilderRemoved).not.toBeCalled()
674
- expect(events.user.permissionAdminRemoved).not.toBeCalled()
672
+ expect(events.user.deleted).toHaveBeenCalledTimes(1)
673
+ expect(events.user.permissionBuilderRemoved).not.toHaveBeenCalled()
674
+ expect(events.user.permissionAdminRemoved).not.toHaveBeenCalled()
675
675
  })
676
676
 
677
677
  it("should be able to destroy an admin user", async () => {
@@ -680,9 +680,9 @@ describe("/api/global/users", () => {
680
680
 
681
681
  await config.api.users.deleteUser(user._id!)
682
682
 
683
- expect(events.user.deleted).toBeCalledTimes(1)
684
- expect(events.user.permissionBuilderRemoved).toBeCalledTimes(1)
685
- expect(events.user.permissionAdminRemoved).toBeCalledTimes(1)
683
+ expect(events.user.deleted).toHaveBeenCalledTimes(1)
684
+ expect(events.user.permissionBuilderRemoved).toHaveBeenCalledTimes(1)
685
+ expect(events.user.permissionAdminRemoved).toHaveBeenCalledTimes(1)
686
686
  })
687
687
 
688
688
  it("should be able to destroy a builder user", async () => {
@@ -691,9 +691,9 @@ describe("/api/global/users", () => {
691
691
 
692
692
  await config.api.users.deleteUser(user._id!)
693
693
 
694
- expect(events.user.deleted).toBeCalledTimes(1)
695
- expect(events.user.permissionBuilderRemoved).toBeCalledTimes(1)
696
- expect(events.user.permissionAdminRemoved).not.toBeCalled()
694
+ expect(events.user.deleted).toHaveBeenCalledTimes(1)
695
+ expect(events.user.permissionBuilderRemoved).toHaveBeenCalledTimes(1)
696
+ expect(events.user.permissionAdminRemoved).not.toHaveBeenCalled()
697
697
  })
698
698
 
699
699
  it("should not be able to destroy account owner", async () => {
@@ -31,13 +31,13 @@ describe("/api/system/migrations", () => {
31
31
  status: 403,
32
32
  })
33
33
  expect(res.body).toEqual({ message: "Unauthorized", status: 403 })
34
- expect(migrateFn).toBeCalledTimes(0)
34
+ expect(migrateFn).toHaveBeenCalledTimes(0)
35
35
  })
36
36
 
37
37
  it("runs migrations", async () => {
38
38
  const res = await config.api.migrations.runMigrations()
39
39
  expect(res.text).toBe("OK")
40
- expect(migrateFn).toBeCalledTimes(1)
40
+ expect(migrateFn).toHaveBeenCalledTimes(1)
41
41
  })
42
42
  })
43
43
 
@@ -28,7 +28,7 @@ describe("/api/system/status", () => {
28
28
  passing: true,
29
29
  },
30
30
  })
31
- expect(accounts.getStatus).toBeCalledTimes(0)
31
+ expect(accounts.getStatus).toHaveBeenCalledTimes(0)
32
32
  config.cloudHosted()
33
33
  })
34
34
 
@@ -45,7 +45,7 @@ describe("/api/system/status", () => {
45
45
 
46
46
  const res = await config.api.status.getStatus()
47
47
 
48
- expect(accounts.getStatus).toBeCalledTimes(1)
48
+ expect(accounts.getStatus).toHaveBeenCalledTimes(1)
49
49
  expect(res.body).toEqual(value)
50
50
  })
51
51
  })
@@ -1,29 +0,0 @@
1
- import { TestConfiguration } from "../../../../tests"
2
-
3
- // TODO
4
-
5
- describe("/api/global/workspaces", () => {
6
- const config = new TestConfiguration()
7
-
8
- beforeAll(async () => {
9
- await config.beforeAll()
10
- })
11
-
12
- afterAll(async () => {
13
- await config.afterAll()
14
- })
15
-
16
- afterEach(() => {
17
- jest.clearAllMocks()
18
- })
19
-
20
- describe("GET /api/global/workspaces", () => {
21
- it("retrieves workspaces", () => {})
22
- })
23
-
24
- describe("DELETE /api/global/workspaces/:id", () => {})
25
-
26
- describe("GET /api/global/workspaces", () => {})
27
-
28
- describe("GET /api/global/workspaces/:id", () => {})
29
- })