@bluedot-innovation/models 10.10.1 → 10.11.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
@@ -1,3 +1,6 @@
1
+ ## 10.11.0
2
+ - Add a feature to select Hello Stack
3
+
1
4
  ## 10.10.1
2
5
  - Only be able to enbale Dwell when Exit is on
3
6
 
@@ -49,6 +49,9 @@
49
49
  },
50
50
  "helloStateTemplates": {
51
51
  "enabled": true
52
+ },
53
+ "helloStack": {
54
+ "name": "Coles"
52
55
  }
53
56
  },
54
57
  "integrations": {
@@ -102,6 +102,18 @@ testCase('Account', () => {
102
102
  assert.match(err.message, /`Invalid` is not a valid enum value for path `type`/)
103
103
  }
104
104
  })
105
+
106
+ assertions('should throw an error when Account has invalid Hello stack', async () => {
107
+ let Account = new AccountModel(account)
108
+ Account.features.helloStack.name = "Invalid"
109
+ try {
110
+ await Account.validate()
111
+ } catch (err) {
112
+ assert.exists(err, 'err object should exist')
113
+ assert.isObject(err.errors)
114
+ assert.match(err.message, /`Invalid` is not a valid enum value for path `name`/)
115
+ }
116
+ })
105
117
  })
106
118
 
107
119
  testCase('recursive invalid entry check', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluedot-innovation/models",
3
- "version": "10.10.1",
3
+ "version": "10.11.0",
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",
@@ -5,6 +5,7 @@ let AccountScreensSchema = require('./AccountScreens')
5
5
  let AccountCemdPersistenceSchema = require('./AccountCemdPersistence')
6
6
  let HelloSsoSchema = require('./HelloSso')
7
7
  const CanvasSsoSchema = require('./CanvasSsoFeature')
8
+ const HelloStackSchema = require('./HelloStackFeature')
8
9
 
9
10
  function helloSsoValidator (value) {
10
11
  const { enabled, identityProvider, dashboardIdentityProvider } = value
@@ -26,6 +27,7 @@ let AccountFeaturesSchema = new mongoose.Schema({
26
27
  helloSso: { type: HelloSsoSchema, validate: { validator: helloSsoValidator, msg: 'When the feature is enbaled, at leat one of provider need to be provided.' } },
27
28
  canvasSso: CanvasSsoSchema,
28
29
  helloStateTemplates: AccountBasicFeatureSchema,
30
+ helloStack: HelloStackSchema
29
31
  }, {
30
32
  _id: false
31
33
  })
@@ -0,0 +1,13 @@
1
+ let mongoose = require('mongoose')
2
+
3
+ let HelloStackSchema = new mongoose.Schema({
4
+ name: {
5
+ type: String,
6
+ required: true,
7
+ enum: ['Core', 'Coles']
8
+ }
9
+ }, {
10
+ _id: false
11
+ })
12
+
13
+ module.exports = HelloStackSchema