@bluedot-innovation/models 8.3.5 → 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 +6 -0
- package/__tests__/account/account.data.json +5 -1
- package/__tests__/account/account.spec.js +13 -0
- package/__tests__/destination/destination.data.json +2 -1
- package/__tests__/destination/destination.spec.js +22 -0
- package/models/Account.js +2 -1
- package/models/Destination.js +2 -1
- package/package.json +1 -1
- package/schemas/AccountFeatures.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
"enabled": true,
|
|
46
46
|
"identityProvider": "test-azure-idp-dev1",
|
|
47
47
|
"domain": "bluedot.io"
|
|
48
|
+
},
|
|
49
|
+
"helloStateTemplates": {
|
|
50
|
+
"enabled": true
|
|
48
51
|
}
|
|
49
52
|
},
|
|
50
53
|
"integrations": {
|
|
@@ -64,5 +67,6 @@
|
|
|
64
67
|
"attentive": {
|
|
65
68
|
"enabled": true
|
|
66
69
|
}
|
|
67
|
-
}
|
|
70
|
+
},
|
|
71
|
+
"type": "Internal"
|
|
68
72
|
}
|
|
@@ -81,6 +81,19 @@ testCase('Account', () => {
|
|
|
81
81
|
})
|
|
82
82
|
})
|
|
83
83
|
})
|
|
84
|
+
|
|
85
|
+
assertions('should throw an error when Account has invalid type', (done) => {
|
|
86
|
+
let Account = new AccountModel(account)
|
|
87
|
+
Account.type = "Invalid"
|
|
88
|
+
|
|
89
|
+
Account.validate((err, res) => {
|
|
90
|
+
assert.notExists(res)
|
|
91
|
+
assert.exists(err, 'err object should exist')
|
|
92
|
+
assert.isObject(err.errors)
|
|
93
|
+
assert.match(err.message, /`Invalid` is not a valid enum value for path `type`/)
|
|
94
|
+
done()
|
|
95
|
+
})
|
|
96
|
+
})
|
|
84
97
|
})
|
|
85
98
|
|
|
86
99
|
testCase('recursive invalid entry check', () => {
|
|
@@ -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/Account.js
CHANGED
|
@@ -32,7 +32,8 @@ let AccountSchema = new mongoose.Schema({
|
|
|
32
32
|
integrations: {
|
|
33
33
|
sfmc: {type: SfmcIntegration},
|
|
34
34
|
attentive: {type: AttentiveIntegration}
|
|
35
|
-
}
|
|
35
|
+
},
|
|
36
|
+
type: { type: String, default: 'Internal', enum: ['Production', 'POC', 'Prospect', 'Internal'] }
|
|
36
37
|
},
|
|
37
38
|
{collection: 'account'})
|
|
38
39
|
|
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
|
})
|