@bluedot-innovation/models 5.1.19 → 5.1.20
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 +3 -0
- package/__tests__/zone/zone.spec.js +10 -0
- package/models/Zone.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -266,6 +266,16 @@ describe('Zone', () => {
|
|
|
266
266
|
helpers.testNullValue(zone, ZoneModel, done)
|
|
267
267
|
})
|
|
268
268
|
|
|
269
|
+
it('should throw an error when projectId is invalid', (done) => {
|
|
270
|
+
zone.projectId = "invalid id"
|
|
271
|
+
let Zone = new ZoneModel(zone)
|
|
272
|
+
Zone.validate((err, res) => {
|
|
273
|
+
assert.exists(err, 'err object should exist')
|
|
274
|
+
assert.match(err.message, /(Invalid Project Id)/i)
|
|
275
|
+
done()
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
|
|
269
279
|
describe('should throw an error when any of the values of the array contains a falsy value', () => {
|
|
270
280
|
let arrayTypeFields = rules.arrayTypeFields
|
|
271
281
|
|
package/models/Zone.js
CHANGED
|
@@ -80,7 +80,7 @@ let zoneSchema = new Schema({
|
|
|
80
80
|
customData: {type: Schema.Types.Mixed, validate: customDataValidators},
|
|
81
81
|
creationTime: {type: Date, default: Date.now},
|
|
82
82
|
lastUpdateTime: {type: Date, default: Date.now},
|
|
83
|
-
projectId: {type: String, required: true},
|
|
83
|
+
projectId: {type: String, required: true, validate: {validator: helpers.validateUUIDv4, message: 'Invalid Project Id.'}},
|
|
84
84
|
state: {type: String, default: StateEnum.ACTIVE, select: false},
|
|
85
85
|
accountId: {type: String, required: true, validate: {isAsync: false, validator: helpers.validateUUIDv4, msg: 'default error message'}}
|
|
86
86
|
}, {collection: 'zone'})
|
package/package.json
CHANGED