@bluedot-innovation/models 7.18.0 → 7.18.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.
package/CHANGELOG.md
CHANGED
|
@@ -620,6 +620,28 @@ describe('Project', () => {
|
|
|
620
620
|
})
|
|
621
621
|
})
|
|
622
622
|
})
|
|
623
|
+
|
|
624
|
+
describe("Incentivio integration validation", () => {
|
|
625
|
+
it('should throw an error when clientId is missing', (done) => {
|
|
626
|
+
delete project.integrations.incentivio.clientId
|
|
627
|
+
let Project = new ProjectModel(project)
|
|
628
|
+
Project.validate((err, res) => {
|
|
629
|
+
assert.exists(err)
|
|
630
|
+
assert.match(err.message, /`clientId` is required/)
|
|
631
|
+
done()
|
|
632
|
+
})
|
|
633
|
+
})
|
|
634
|
+
|
|
635
|
+
it('should throw an error when nowReadyEnabled is non boolean', (done) => {
|
|
636
|
+
project.integrations.incentivio.nowReadyEnabled = "invalid"
|
|
637
|
+
let Project = new ProjectModel(project)
|
|
638
|
+
Project.validate((err, res) => {
|
|
639
|
+
assert.exists(err)
|
|
640
|
+
assert.match(err.message, /Cast to Boolean failed for value "invalid" .* at path "nowReadyEnabled"/)
|
|
641
|
+
done()
|
|
642
|
+
})
|
|
643
|
+
})
|
|
644
|
+
})
|
|
623
645
|
})
|
|
624
646
|
|
|
625
647
|
describe('should throw an error when any of the values of the array contains a falsy value', () => {
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
let IncentivioIntegrationSchema = new mongoose.Schema({
|
|
4
|
+
nowReadyEnabled: {type: Boolean, default: true},
|
|
5
|
+
clientId: {type: String, required: true},
|
|
6
|
+
lastSyncedTime: {type: Date}
|
|
7
|
+
}, {
|
|
8
|
+
_id: false
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
module.exports = IncentivioIntegrationSchema
|
package/schemas/Integration.js
CHANGED
|
@@ -4,7 +4,8 @@ const segmentIntegrationSchema = require('./SegmentIntegration')
|
|
|
4
4
|
const oneSignalIntegrationSchema = require('./OneSignalIntegration')
|
|
5
5
|
const bbotIntegrationSchema = require('./BbotIntegration')
|
|
6
6
|
const flipdishIntegrationSchema = require('./FlipdishIntegration')
|
|
7
|
-
const projectAttentiveIntegrationSchema = require('./ProjectAttentiveIntegration')
|
|
7
|
+
const projectAttentiveIntegrationSchema = require('./ProjectAttentiveIntegration')
|
|
8
|
+
const incentivioIntegrationSchema = require('./IncentivioIntegration')
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
const MParticleSchema = new mongoose.Schema({
|
|
@@ -58,7 +59,8 @@ const IntegrationSchema = new mongoose.Schema({
|
|
|
58
59
|
oneSignal: { type: oneSignalIntegrationSchema },
|
|
59
60
|
bbot: { type: bbotIntegrationSchema },
|
|
60
61
|
flipdish: { type: flipdishIntegrationSchema },
|
|
61
|
-
attentive: { type: projectAttentiveIntegrationSchema }
|
|
62
|
+
attentive: { type: projectAttentiveIntegrationSchema },
|
|
63
|
+
incentivio: { type: incentivioIntegrationSchema }
|
|
62
64
|
},{ _id : false });
|
|
63
65
|
function apiKeyValidator(value){
|
|
64
66
|
// check if the value is a non-empty string
|