@bluedot-innovation/models 8.4.2 → 8.5.0
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/CHANGELOG.md
CHANGED
|
@@ -273,12 +273,22 @@ describe('Project', () => {
|
|
|
273
273
|
})
|
|
274
274
|
})
|
|
275
275
|
|
|
276
|
-
it('should not validate if hello.
|
|
277
|
-
project.hello.
|
|
276
|
+
it('should not validate if hello.activeTtl is not an integer', (done) => {
|
|
277
|
+
project.hello.activeTtl = 1.5
|
|
278
278
|
let Project = new ProjectModel(project)
|
|
279
279
|
Project.validate((err, res) => {
|
|
280
280
|
assert.exists(err)
|
|
281
|
-
assert.match(err.message, /hello.
|
|
281
|
+
assert.match(err.message, /hello.activeTtl should be an integer number/)
|
|
282
|
+
done()
|
|
283
|
+
})
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
it('should not validate if hello.finalTtl is not an integer', (done) => {
|
|
287
|
+
project.hello.finalTtl = 1.5
|
|
288
|
+
let Project = new ProjectModel(project)
|
|
289
|
+
Project.validate((err, res) => {
|
|
290
|
+
assert.exists(err)
|
|
291
|
+
assert.match(err.message, /hello.finalTtl should be an integer number/)
|
|
282
292
|
done()
|
|
283
293
|
})
|
|
284
294
|
})
|
package/package.json
CHANGED
package/schemas/ProjectHello.js
CHANGED
|
@@ -2,7 +2,8 @@ let mongoose = require('mongoose')
|
|
|
2
2
|
const helpers = require('../helpers')
|
|
3
3
|
|
|
4
4
|
let ProjectHelloSchema = new mongoose.Schema({
|
|
5
|
-
|
|
5
|
+
activeTtl: {type: Number, validate: { validator: Number.isInteger, msg: 'hello.activeTtl should be an integer number' }},
|
|
6
|
+
finalTtl: {type: Number, validate: { validator: Number.isInteger, msg: 'hello.finalTtl should be an integer number' }},
|
|
6
7
|
ssoLinkingCode: {type: String, validate: {validator: helpers.validateSsoLinkingCode, msg: 'SSO linking code must be a 12 character capital alphanumeric text'}}
|
|
7
8
|
}, {
|
|
8
9
|
_id: false
|