@bluedot-innovation/models 8.3.6 → 8.4.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
|
@@ -58,6 +58,16 @@ describe('Valid Destination ', () => {
|
|
|
58
58
|
done()
|
|
59
59
|
})
|
|
60
60
|
})
|
|
61
|
+
|
|
62
|
+
it('should validate a valid destination without stateTemplateId', (done) => {
|
|
63
|
+
delete destination.stateTemplateId
|
|
64
|
+
let Destination = new DestinationModel(destination)
|
|
65
|
+
Destination.validate((err, res) => {
|
|
66
|
+
assert.notExists(res)
|
|
67
|
+
assert(err === null, 'err equals null')
|
|
68
|
+
done()
|
|
69
|
+
})
|
|
70
|
+
})
|
|
61
71
|
})
|
|
62
72
|
|
|
63
73
|
describe('Invalid Destination ', () => {
|
|
@@ -188,4 +198,16 @@ describe('Invalid Destination ', () => {
|
|
|
188
198
|
done()
|
|
189
199
|
})
|
|
190
200
|
})
|
|
201
|
+
|
|
202
|
+
it("should throw an error if stateTemplateId is not a uuid", (done) => {
|
|
203
|
+
destination.stateTemplateId = "something"
|
|
204
|
+
let Destination = new DestinationModel(destination)
|
|
205
|
+
Destination.validate((err, res) => {
|
|
206
|
+
assert.notExists(res)
|
|
207
|
+
assert.exists(err)
|
|
208
|
+
console.log(err.message)
|
|
209
|
+
assert.match(err.message, /Invalid state template id/)
|
|
210
|
+
done()
|
|
211
|
+
})
|
|
212
|
+
})
|
|
191
213
|
})
|
package/models/Destination.js
CHANGED
|
@@ -17,7 +17,8 @@ const DestinationSchema = new mongoose.Schema({
|
|
|
17
17
|
projectId: {type: String, required: true, validate: {validator: helpers.validateUUIDv4, msg: 'Invalid projectId'}},
|
|
18
18
|
creationTime: {type: Date, default: Date.now},
|
|
19
19
|
lastUpdateTime: {type: Date, default: Date.now},
|
|
20
|
-
waitTime: { type: WaitTime }
|
|
20
|
+
waitTime: { type: WaitTime },
|
|
21
|
+
stateTemplateId: {type: String, validate: {validator: helpers.validateUUIDv4, msg: 'Invalid state template id'}}
|
|
21
22
|
}, {collection: 'destination'})
|
|
22
23
|
|
|
23
24
|
DestinationSchema.plugin(patcher)
|
package/package.json
CHANGED
|
@@ -16,7 +16,8 @@ let AccountFeaturesSchema = new mongoose.Schema({
|
|
|
16
16
|
automaticDestinationCreation: AccountBasicFeatureSchema,
|
|
17
17
|
nowReadyConfiguration: AccountBasicFeatureSchema,
|
|
18
18
|
helloSso: HelloSsoSchema,
|
|
19
|
-
canvasSso: CanvasSsoSchema
|
|
19
|
+
canvasSso: CanvasSsoSchema,
|
|
20
|
+
helloStateTemplates: AccountBasicFeatureSchema,
|
|
20
21
|
}, {
|
|
21
22
|
_id: false
|
|
22
23
|
})
|