@kalisio/kdk 2.1.0 → 2.1.2

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.
@@ -15,9 +15,11 @@ export async function sendNewSubscriptionEmail (hook) {
15
15
  throw new Error('The \'sendNewSubscriptionEmail\' hook should only be used as a \'after\' hook.')
16
16
  }
17
17
 
18
- // Check for a new subscription
18
+ // Check for a new subscription if any
19
19
  const updatedUser = hook.result
20
20
  const previousUser = hook.params.user
21
+ // If we can't compare abort, eg f-a-m might patch user to update tokens
22
+ if (!updatedUser || !previousUser) return hook
21
23
  const newSubscription = _.differenceBy(_.get(updatedUser, 'subscriptions', []), _.get(previousUser, 'subscriptions', []), 'endpoint')
22
24
  if (_.size(newSubscription) !== 1) return
23
25
 
@@ -66,7 +66,7 @@ export default function (name, app, options) {
66
66
  } else if (_.has(user, 'sponsor.id')) {
67
67
  try {
68
68
  const sponsor = await userService.get(user.sponsor.id)
69
- email.sponsor = sponsor.name
69
+ email.sponsor = _.get(sponsor, 'profile.name')
70
70
  } catch (error) {
71
71
  // We will not send the sponsor name in this case
72
72
  }
@@ -76,7 +76,7 @@ const defaultActions = [{
76
76
  }
77
77
  }
78
78
  ]
79
- if (_.isNil(bugReport.address)) {
79
+ if (!_.isNil(bugReport.address)) {
80
80
  defaultActions.unshift({
81
81
  id: 'report-bug',
82
82
  icon: 'las la-bug',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kalisio/kdk",
3
3
  "description": "Kalisio Development Kit",
4
- "version": "2.1.0",
4
+ "version": "2.1.2",
5
5
  "homepage": "https://github.com/kalisio/kdk",
6
6
  "type": "module",
7
7
  "keywords": [
@@ -1,9 +1,9 @@
1
- import _ from 'lodash'
2
1
  import common from 'feathers-hooks-common'
3
2
  import request from 'superagent'
4
3
  import chai from 'chai'
5
4
  import chailint from 'chai-lint'
6
5
  import config from 'config'
6
+ import { addSubscription } from '@kalisio/feathers-webpush/client.js'
7
7
  import core, { kdk, hooks } from '../../../core/api/index.js'
8
8
  import { permissions } from '../../../core/common/index.js'
9
9
  // We now rely on mailer stub which is faster
@@ -19,6 +19,17 @@ describe('core:account', () => {
19
19
  userService, authenticationService, mailerService, accountService,
20
20
  gmailUser, mailerStub, userObject
21
21
 
22
+ const subscription = {
23
+ endpoint: process.env.SUBSCRIPTION_ENDPOINT,
24
+ keys: {
25
+ p256dh: process.env.SUBSCRIPTION_KEY_P256DH,
26
+ auth: process.env.SUBSCRIPTION_KEY_AUTH
27
+ },
28
+ browser: {
29
+ name: 'chrome'
30
+ }
31
+ }
32
+
22
33
  before(async () => {
23
34
  chailint(chai, util)
24
35
 
@@ -127,8 +138,10 @@ describe('core:account', () => {
127
138
  // Let enough time to process
128
139
  .timeout(10000)
129
140
 
130
- it('check invitation email', (done) => {
131
- mailerStub.checkEmail(userObject, mailerService.options.auth.user, 'Welcome', done)
141
+ it('check invitation email', () => {
142
+ mailerStub.checkEmail(userObject, mailerService.options.auth.user,
143
+ 'Welcome', [new RegExp(userObject.profile.name, 'g'), new RegExp(userObject.email, 'g')])
144
+ mailerStub.checkNbEmails(0)
132
145
  // Add some delay to wait for email reception
133
146
  /*
134
147
  setTimeout(() => {
@@ -164,11 +177,13 @@ describe('core:account', () => {
164
177
  .timeout(5000)
165
178
 
166
179
  it('creates a user', async () => {
167
- const user = await userService.create({
180
+ let user = {
168
181
  email: gmailUser,
169
182
  password: 'Pass;word1',
170
183
  name: 'test-user'
171
- })
184
+ }
185
+ await addSubscription(user, subscription, 'subscriptions')
186
+ user = await userService.create(user)
172
187
  userObject = user
173
188
  expect(userObject.isVerified).toExist()
174
189
  expect(userObject.isVerified).beFalse()
@@ -178,8 +193,10 @@ describe('core:account', () => {
178
193
  // Let enough time to process
179
194
  .timeout(10000)
180
195
 
181
- it('check signup verification email', (done) => {
182
- mailerStub.checkEmail(userObject, mailerService.options.auth.user, 'Confirm your signup', done)
196
+ it('check signup verification email', () => {
197
+ mailerStub.checkEmail(userObject, mailerService.options.auth.user,
198
+ 'Confirm your signup', [new RegExp(userObject.profile.name, 'g'), new RegExp(userObject.email, 'g'), new RegExp(userObject.verifyShortToken, 'g'), new RegExp(userObject.verifyShortToken, 'g')])
199
+ mailerStub.checkNbEmails(0)
183
200
  // Add some delay to wait for email reception
184
201
  /*
185
202
  setTimeout(() => {
@@ -197,15 +214,17 @@ describe('core:account', () => {
197
214
  user: { email: gmailUser },
198
215
  token: userObject.verifyShortToken
199
216
  }
200
- })
217
+ }, { user: userObject })
201
218
  userObject = user
202
219
  expect(userObject.isVerified).beTrue()
203
220
  })
204
221
  // Let enough time to process
205
222
  .timeout(5000)
206
223
 
207
- it('check signup verified email', (done) => {
208
- mailerStub.checkEmail(userObject, mailerService.options.auth.user, 'Thank you, your email has been verified', done)
224
+ it('check signup verified email', () => {
225
+ mailerStub.checkEmail(userObject, mailerService.options.auth.user,
226
+ 'Thank you, your email has been verified', [new RegExp(userObject.email, 'g')])
227
+ mailerStub.checkNbEmails(0)
209
228
  // Add some delay to wait for email reception
210
229
  /*
211
230
  setTimeout(() => {
@@ -230,21 +249,19 @@ describe('core:account', () => {
230
249
  // Let enough time to process
231
250
  .timeout(10000)
232
251
 
233
- it('check reset password request email', (done) => {
234
- const checkToken = (err, message) => {
235
- if (_.isNil(err)) {
236
- // Extract token from email beign compatible either wit mailer stub or gmail api
237
- message = message.html || Buffer.from(message.body.data, 'base64').toString()
238
- const tokenEntry = '<strong>'
239
- const firstTokenIndex = message.indexOf(tokenEntry) + tokenEntry.length
240
- const lastTokenIndex = message.indexOf('</strong>')
241
- token = message.substring(firstTokenIndex, lastTokenIndex)
242
- done()
243
- } else {
244
- done(err)
245
- }
252
+ it('check reset password request email', () => {
253
+ const checkToken = (message) => {
254
+ // Extract token from email beign compatible either wit mailer stub or gmail api
255
+ message = message.html || Buffer.from(message.body.data, 'base64').toString()
256
+ const tokenEntry = '<strong>'
257
+ const firstTokenIndex = message.indexOf(tokenEntry) + tokenEntry.length
258
+ const lastTokenIndex = message.indexOf('</strong>')
259
+ token = message.substring(firstTokenIndex, lastTokenIndex)
246
260
  }
247
- mailerStub.checkEmail(userObject, mailerService.options.auth.user, 'Reset your password', checkToken)
261
+ const message = mailerStub.checkEmail(userObject, mailerService.options.auth.user,
262
+ 'Reset your password', [new RegExp(userObject.profile.name, 'g'), new RegExp(userObject.email, 'g')])
263
+ checkToken(message)
264
+ mailerStub.checkNbEmails(0)
248
265
  // Add some delay to wait for email reception
249
266
  /*
250
267
  setTimeout(() => {
@@ -293,8 +310,10 @@ describe('core:account', () => {
293
310
  // Let enough time to process
294
311
  .timeout(15000)
295
312
 
296
- it('check reset password email', (done) => {
297
- mailerStub.checkEmail(userObject, mailerService.options.auth.user, 'Your password was reset', done)
313
+ it('check reset password email', () => {
314
+ mailerStub.checkEmail(userObject, mailerService.options.auth.user,
315
+ 'Your password was reset', [new RegExp(userObject.profile.name, 'g'), new RegExp(userObject.email, 'g')])
316
+ mailerStub.checkNbEmails(0)
298
317
  // Add some delay to wait for email reception
299
318
  /*
300
319
  setTimeout(() => {
@@ -354,8 +373,10 @@ describe('core:account', () => {
354
373
  // Let enough time to process
355
374
  .timeout(15000)
356
375
 
357
- it('check changed password email', (done) => {
358
- mailerStub.checkEmail(userObject, mailerService.options.auth.user, 'Your password was changed', done)
376
+ it('check changed password email', () => {
377
+ mailerStub.checkEmail(userObject, mailerService.options.auth.user,
378
+ 'Your password was changed', [new RegExp(userObject.profile.name, 'g'), new RegExp(userObject.email, 'g')])
379
+ mailerStub.checkNbEmails(0)
359
380
  // Add some delay to wait for email reception
360
381
  /*
361
382
  setTimeout(() => {
@@ -397,8 +418,10 @@ describe('core:account', () => {
397
418
  // Let enough time to process
398
419
  .timeout(10000)
399
420
 
400
- it('check identity change email', (done) => {
401
- mailerStub.checkEmail(userObject, mailerService.options.auth.user, 'Your account information was changed', done)
421
+ it('check identity change email', () => {
422
+ mailerStub.checkEmail(userObject, mailerService.options.auth.user,
423
+ 'Your account information was changed', [new RegExp(userObject.profile.name, 'g'), new RegExp(gmailUser.replace('com', 'xyz'), 'g'), new RegExp(userObject.verifyShortToken, 'g')])
424
+ mailerStub.checkNbEmails(0)
402
425
  // Add some delay to wait for email reception
403
426
  /*
404
427
  setTimeout(() => {
@@ -1,7 +1,8 @@
1
- import { addSubscription, removeSubscription } from '@kalisio/feathers-webpush/client.js'
1
+ import _ from 'lodash'
2
2
  import chai from 'chai'
3
3
  import chailint from 'chai-lint'
4
4
  import config from 'config'
5
+ import { addSubscription, removeSubscription } from '@kalisio/feathers-webpush/client.js'
5
6
  import core, { kdk, hooks } from '../../../core/api/index.js'
6
7
  import { permissions } from '../../../core/common/index.js'
7
8
  // We now rely on mailer stub which is faster
@@ -113,8 +114,10 @@ describe('core:push', () => {
113
114
  .timeout(5000)
114
115
 
115
116
  it('a user should be able to register its subscriptions', async () => {
117
+ const previousUser = _.cloneDeep(user)
116
118
  await addSubscription(user, subscription, 'subscriptions')
117
- await userService.patch(user._id, { subscriptions: user.subscriptions })
119
+ // Subscriptions change detection requires the previous user to be set
120
+ await userService.patch(user._id, { subscriptions: user.subscriptions }, { user: previousUser })
118
121
  expect(user.subscriptions).toExist()
119
122
  expect(user.subscriptions.length === 1).beTrue()
120
123
  expect(user.subscriptions[0].endpoint).to.equal(subscription.endpoint)
@@ -125,11 +128,14 @@ describe('core:push', () => {
125
128
  // Let enough time to process
126
129
  .timeout(10000)
127
130
 
128
- it('check new subscription emails', (done) => {
131
+ it('check new subscription emails', () => {
129
132
  // Add some delay to wait for email reception
130
- mailerStub.checkEmail(user.subscriptions[0], mailerService.options.auth.user, 'Security alert - new browser detected', () => {
131
- mailerStub.checkEmail(user.subscriptions[0], mailerService.options.auth.user, 'Security alert - new browser detected', done)
132
- })
133
+ mailerStub.checkEmail(user.subscriptions[0], mailerService.options.auth.user,
134
+ 'Security alert - new browser detected', [new RegExp(user.profile.name, 'g'), new RegExp(subscription.browser.name, 'g')])
135
+ mailerStub.checkNbEmails(1)
136
+ mailerStub.checkEmail(user.subscriptions[0], mailerService.options.auth.user,
137
+ 'Security alert - new browser detected', [new RegExp(user.profile.name, 'g'), new RegExp(subscription.browser.name, 'g')])
138
+ mailerStub.checkNbEmails(0)
133
139
  })
134
140
  // Let enough time to process
135
141
  .timeout(15000)
@@ -0,0 +1,105 @@
1
+ {"level":"error","message":"Could not connect to mongodb database(s), please check your configuration failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {\n name: 'MongoNetworkError'\n}]","name":"MongoNetworkError","stack":"MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {\n name: 'MongoNetworkError'\n}]\n at Pool.<anonymous> (/home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/topologies/server.js:441:11)\n at Pool.emit (node:events:513:28)\n at /home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/pool.js:564:14\n at /home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/pool.js:1000:11\n at /home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/connect.js:32:7\n at callback (/home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/connect.js:300:5)\n at Socket.<anonymous> (/home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/connect.js:330:7)\n at Object.onceWrapper (node:events:628:26)\n at Socket.emit (node:events:513:28)\n at emitErrorNT (node:internal/streams/destroy:157:8)\n at emitErrorCloseNT (node:internal/streams/destroy:122:3)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"}
2
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
3
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
4
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
5
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
6
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
7
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
8
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
9
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
10
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
11
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
12
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
13
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
14
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
15
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
16
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
17
+ {"level":"error","message":"Could not connect to mongodb database(s), please check your configuration failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {\n name: 'MongoNetworkError'\n}]","name":"MongoNetworkError","stack":"MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017\n at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) {\n name: 'MongoNetworkError'\n}]\n at Pool.<anonymous> (/home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/topologies/server.js:441:11)\n at Pool.emit (node:events:513:28)\n at /home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/pool.js:564:14\n at /home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/pool.js:1000:11\n at /home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/connect.js:32:7\n at callback (/home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/connect.js:300:5)\n at Socket.<anonymous> (/home/luc/Development/kalisio/kdk/node_modules/mongodb/lib/core/connection/connect.js:330:7)\n at Object.onceWrapper (node:events:628:26)\n at Socket.emit (node:events:513:28)\n at emitErrorNT (node:internal/streams/destroy:157:8)\n at emitErrorCloseNT (node:internal/streams/destroy:122:3)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"}
18
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
19
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
20
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
21
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
22
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
23
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
24
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
25
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
26
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
27
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
28
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
29
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
30
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
31
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
32
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
33
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
34
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
35
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
36
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
37
+ {"level":"error","message":"error: api/tags - Method: create: You are not allowed to access service tags"}
38
+ {"level":"error","message":"error: api/users - Method: create: The provided password does not comply to the password policy"}
39
+ {"level":"error","message":"error: api/users - Method: create: The provided password does not comply to the password policy"}
40
+ {"level":"error","message":"error: api/authorisations - Method: create: You are not allowed to change authorisation on resource"}
41
+ {"level":"error","message":"error: api/authorisations - Method: remove: You are not allowed to change authorisation on subject(s)"}
42
+ {"level":"info","message":"This is a log test"}
43
+ {"level":"error","message":"error: api/service - Method: create: validation failed"}
44
+ {"level":"error","message":"error: api/service - Method: create: validation failed"}
45
+ {"level":"error","message":"error: api/service - Method: create: validation failed"}
46
+ {"level":"error","message":"error: api/service - Method: create: validation failed"}
47
+ {"level":"error","message":"error: api/storage - Method: get: The specified key does not exist."}
48
+ {"level":"error","message":"error: api/storage - Method: get: The specified key does not exist."}
49
+ {"level":"error","message":"error: api/organisations - Method: create: You are not allowed to access service organisations"}
50
+ {"level":"error","message":"error: api/authorisations - Method: create: You are not allowed to perform create operation on authorisations"}
51
+ {"level":"error","message":"error: api/650c0b497e1b96284ca81b2f/storage - Method: get: You are not allowed to access service 650c0b497e1b96284ca81b2f/storage"}
52
+ {"level":"error","message":"error: api/650c0b497e1b96284ca81b2f/groups - Method: create: You are not allowed to perform create operation on groups"}
53
+ {"level":"error","message":"error: api/650c0b497e1b96284ca81b2f/groups - Method: patch: You are not allowed to perform patch operation on groups"}
54
+ {"level":"error","message":"error: api/authorisations - Method: create: You are not allowed to perform create operation on authorisations"}
55
+ {"level":"error","message":"error: api/authorisations - Method: create: You are not allowed to perform create operation on authorisations"}
56
+ {"level":"error","message":"error: api/users - Method: remove: You are not allowed to delete the user undefined"}
57
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
58
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
59
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
60
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
61
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
62
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
63
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
64
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
65
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
66
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
67
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
68
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
69
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
70
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
71
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
72
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
73
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
74
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
75
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
76
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
77
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
78
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
79
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
80
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
81
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
82
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
83
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
84
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
85
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
86
+ {"level":"error","message":"error: api/account - Method: create: Expected string value. (authLocalMgnt)"}
87
+ {"level":"error","message":"error: api/authentication - Method: create: Invalid login"}
88
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
89
+ {"level":"error","message":"error: api/account - Method: create: Current password is incorrect."}
90
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
91
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
92
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
93
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
94
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
95
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
96
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
97
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
98
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
99
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
100
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
101
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
102
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
103
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
104
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
105
+ {"level":"error","message":"error: api/account - Method: create: The provided password does not comply to the password policy"}
@@ -14,12 +14,21 @@ export const createMailerStub = (stubConfig) => {
14
14
  },
15
15
  // Helper function used to check if a given email has been sent
16
16
  // Erase it after check
17
- checkEmail: (user, fromValue, subjectValue, done) => {
17
+ checkEmail: (user, fromValue, subjectValue, contentRegExs) => {
18
18
  expect(emails.length > 0).beTrue()
19
19
  const message = emails[0]
20
20
  expect(message.from).to.equal(fromValue)
21
21
  expect(message.subject).to.equal(subjectValue)
22
- done(null, emails.shift())
22
+ if (contentRegExs) {
23
+ // Unify as array if single item
24
+ if (!Array.isArray(contentRegExs)) contentRegExs = [contentRegExs]
25
+ contentRegExs.forEach(contentRegEx => expect(contentRegEx.test(message.html)).beTrue())
26
+ }
27
+ return emails.shift()
28
+ },
29
+ // Helper function used to check the number of sent emails
30
+ checkNbEmails: (count) => {
31
+ expect(emails.length).to.equal(count)
23
32
  }
24
33
  }, stubConfig)
25
34
  }
@@ -0,0 +1,12 @@
1
+ {"level":"info","message":"Logger configured"}
2
+ {"level":"info","message":"Initializing weacast-gfs plugin"}
3
+ {"level":"info","message":"Initializing gfs-world forecast"}
4
+ {"level":"info","message":"Checking for up-to-date forecast data on gfs-world/u-wind"}
5
+ {"level":"info","message":"Checking for up-to-date forecast data on gfs-world/v-wind"}
6
+ {"level":"info","message":"Completed forecast data update on gfs-world/u-wind"}
7
+ {"level":"info","message":"Completed forecast data update on gfs-world/v-wind"}
8
+ {"level":"error","message":"Cannot check alert 650c0b562a0981289bf52af2 as target probes service is not available"}
9
+ {"level":"error","message":"Cannot check alert 650c0b742a0981289bf52af4 as no data is available for gfs-world"}
10
+ {"level":"error","message":"Cannot check alert 650c0b922a0981289bf53037 as no data is available for features service vigicrues-observations"}
11
+ {"level":"info","message":"Logger configured"}
12
+ {"level":"error","message":"error: api/catalog - Method: create: Object with name equals to dummy already exist for service catalog"}