@bluedot-innovation/models 7.18.1 → 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
@@ -1,3 +1,6 @@
1
+ ## 7.18.2
2
+ - make clientId in Incentivio integration mandatory
3
+
1
4
  ## 7.18.1
2
5
  - Add Incentivio integration to Project
3
6
 
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "7.18.1",
3
+ "version": "7.18.2",
4
4
  "main": "Models.js",
5
5
  "scripts": {
6
6
  "lint": "./node_modules/.bin/eslint -c .eslintrc.js ./models/*.js ./__tests__/**/*.js ./__tests__/**/**/*.js ./schemas/*.js",
@@ -2,7 +2,7 @@ const mongoose = require('mongoose');
2
2
 
3
3
  let IncentivioIntegrationSchema = new mongoose.Schema({
4
4
  nowReadyEnabled: {type: Boolean, default: true},
5
- clientId: {type: String},
5
+ clientId: {type: String, required: true},
6
6
  lastSyncedTime: {type: Date}
7
7
  }, {
8
8
  _id: false