@bluedot-innovation/models 7.5.5 → 7.5.8
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 +9 -0
- package/Models.js +0 -5
- package/__tests__/account/account.data.json +6 -0
- package/__tests__/account/account.spec.js +22 -0
- package/__tests__/project/project.data.json +4 -0
- package/__tests__/project/project.spec.js +12 -0
- package/package.json +1 -1
- package/schemas/AccountCemdPersistence.js +9 -0
- package/schemas/AccountFeatures.js +3 -1
- package/schemas/Integration.js +4 -4
- package/schemas/OloIntegration.js +10 -0
- package/models/TestDevice.js +0 -42
- package/models/TestDeviceCluster.js +0 -32
- package/models/TestInstance.js +0 -60
- package/models/TestScenario.js +0 -40
package/CHANGELOG.md
CHANGED
package/Models.js
CHANGED
|
@@ -28,11 +28,6 @@ Models.TravelPath = require('./models/conditions/TravelPath').Model
|
|
|
28
28
|
Models.Speed = require('./models/conditions/Speed').Model
|
|
29
29
|
Models.TravelDirection = require('./models/conditions/TravelDirection').Model
|
|
30
30
|
|
|
31
|
-
// Test Management Portal
|
|
32
|
-
Models.TestDevice = require('./models/TestDevice').Model
|
|
33
|
-
Models.TestDeviceCluster = require('./models/TestDeviceCluster').Model
|
|
34
|
-
Models.TestInstance = require('./models/TestInstance').Model
|
|
35
|
-
Models.TestScenario = require('./models/TestScenario').Model
|
|
36
31
|
// Added V1 Application model to get Remote Config details for Test Management Portal.
|
|
37
32
|
// This model can be removed once we start using V2 models.
|
|
38
33
|
Models.Application = require('./models/Application').Model
|
|
@@ -39,6 +39,28 @@ testCase('Account', () => {
|
|
|
39
39
|
done()
|
|
40
40
|
})
|
|
41
41
|
})
|
|
42
|
+
|
|
43
|
+
it('Should valid the account when CEMD whitelistedFields is null', (done) => {
|
|
44
|
+
account = JSON.parse(JSON.stringify(account))
|
|
45
|
+
account.features.cemdPersistence.whitelistedFields = null
|
|
46
|
+
const Account = new AccountModel(account)
|
|
47
|
+
Account.validate((err, res) => {
|
|
48
|
+
assert.notExists(res)
|
|
49
|
+
assert(err === null, 'err equals null')
|
|
50
|
+
done()
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('Should valid the account when CEMD whitelistedFields is undefined', (done) => {
|
|
55
|
+
account = JSON.parse(JSON.stringify(account))
|
|
56
|
+
delete account.features.cemdPersistence.whitelistedFields
|
|
57
|
+
const Account = new AccountModel(account)
|
|
58
|
+
Account.validate((err, res) => {
|
|
59
|
+
assert.notExists(res)
|
|
60
|
+
assert(err === null, 'err equals null')
|
|
61
|
+
done()
|
|
62
|
+
})
|
|
63
|
+
})
|
|
42
64
|
})
|
|
43
65
|
|
|
44
66
|
testCase('Invalid Account', () => {
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"androidSecretKey": "eZqphc1Vh2dqaIQEvz4APNbErZkW_AaaRmwE8BCmYpHZFc3n_ZKajTLgJgFqLNNN",
|
|
51
51
|
"iosApiKey": "us1-a5e6eefe90fe704aba0a7d2daa00baaa",
|
|
52
52
|
"iosSecretKey": "fZqphc1Vh2dqaIQEvz4APNbErZkW_AaaRmwE8BCmYpHZFc3n_ZKajTLgJgFqLNNN"
|
|
53
|
+
},
|
|
54
|
+
"olo": {
|
|
55
|
+
"sharedSecret": "jhFGJHKJhkHIjklJ",
|
|
56
|
+
"nowReadyEnabled": true
|
|
53
57
|
}
|
|
54
58
|
},
|
|
55
59
|
"tempo": {
|
|
@@ -509,6 +509,18 @@ describe('Project', () => {
|
|
|
509
509
|
})
|
|
510
510
|
})
|
|
511
511
|
})
|
|
512
|
+
|
|
513
|
+
describe("olo integration validation", () => {
|
|
514
|
+
it('should throw an error when sharedSecret is missing', (done) => {
|
|
515
|
+
delete project.integrations.olo.sharedSecret
|
|
516
|
+
let Project = new ProjectModel(project)
|
|
517
|
+
Project.validate((err, res) => {
|
|
518
|
+
assert.exists(err)
|
|
519
|
+
assert.match(err.message, /`sharedSecret` is required/)
|
|
520
|
+
done()
|
|
521
|
+
})
|
|
522
|
+
})
|
|
523
|
+
})
|
|
512
524
|
})
|
|
513
525
|
|
|
514
526
|
describe('should throw an error when any of the values of the array contains a falsy value', () => {
|
package/package.json
CHANGED
|
@@ -2,12 +2,14 @@ let mongoose = require('mongoose')
|
|
|
2
2
|
let AccountTempoSchema = require('./AccountTempo')
|
|
3
3
|
let AccountBasicFeatureSchema = require('./AccountBasicFeature')
|
|
4
4
|
let AccountScreensSchema = require('./AccountScreens')
|
|
5
|
+
let AccountCemdPersistenceSchema = require('./AccountCemdPersistence')
|
|
5
6
|
|
|
6
7
|
let AccountFeaturesSchema = new mongoose.Schema({
|
|
7
8
|
tempo: AccountTempoSchema,
|
|
8
9
|
realTimeDashboard: AccountBasicFeatureSchema,
|
|
9
10
|
screens: AccountScreensSchema,
|
|
10
|
-
insights: AccountBasicFeatureSchema
|
|
11
|
+
insights: AccountBasicFeatureSchema,
|
|
12
|
+
cemdPersistence: AccountCemdPersistenceSchema
|
|
11
13
|
}, {
|
|
12
14
|
_id: false
|
|
13
15
|
})
|
package/schemas/Integration.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let mongoose = require("mongoose");
|
|
2
|
-
|
|
2
|
+
const oloIntegrationSchema = require('./OloIntegration')
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
const MParticleSchema = new mongoose.Schema({
|
|
@@ -46,9 +46,9 @@ const IntegrationSchema = new mongoose.Schema({
|
|
|
46
46
|
validator:androidPairValidator,
|
|
47
47
|
msg: 'both androidSecretKey and androidApiKey are required'
|
|
48
48
|
}
|
|
49
|
-
]
|
|
50
|
-
|
|
51
|
-
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
olo: { type: oloIntegrationSchema }
|
|
52
52
|
},{ _id : false });
|
|
53
53
|
function apiKeyValidator(value){
|
|
54
54
|
// check if the value is a non-empty string
|
package/models/TestDevice.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Andrew on 01/03/2017.
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
let mongoose = require('mongoose')
|
|
7
|
-
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
8
|
-
|
|
9
|
-
let TestDeviceSchema = new mongoose.Schema({
|
|
10
|
-
name: String,
|
|
11
|
-
identifier: String,
|
|
12
|
-
os: String,
|
|
13
|
-
osVersion: String,
|
|
14
|
-
hostToken: String,
|
|
15
|
-
batteryToken: String,
|
|
16
|
-
model: String,
|
|
17
|
-
trackingDevice: {type: Boolean, default: false},
|
|
18
|
-
creationTime: {type: Date, default: Date.now},
|
|
19
|
-
lastUpdateTime: {type: Date, default: Date.now},
|
|
20
|
-
serialNumber: String,
|
|
21
|
-
mobileNumber: String,
|
|
22
|
-
deviceType: String,
|
|
23
|
-
state: {type: String, default: StateEnum.ACTIVE},
|
|
24
|
-
comments: String,
|
|
25
|
-
imei: String,
|
|
26
|
-
udid: String
|
|
27
|
-
},
|
|
28
|
-
{ collection: 'testDevice'})
|
|
29
|
-
|
|
30
|
-
// optional mongoose
|
|
31
|
-
let model = (mongooseInstance) => {
|
|
32
|
-
let TestDevice
|
|
33
|
-
if (mongooseInstance) {
|
|
34
|
-
TestDevice = mongooseInstance.model('TestDevice', TestDeviceSchema)
|
|
35
|
-
} else {
|
|
36
|
-
TestDevice = mongoose.model('TestDevice', TestDeviceSchema)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return TestDevice
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
module.exports = { Model: model, Schema: TestDeviceSchema }
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Andrew on 02/03/2017.
|
|
3
|
-
* Copyright : Bluedot Innovation.
|
|
4
|
-
*/
|
|
5
|
-
let mongoose = require('mongoose')
|
|
6
|
-
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
7
|
-
|
|
8
|
-
let TestDeviceClusterSchema = new mongoose.Schema(
|
|
9
|
-
{
|
|
10
|
-
name: String,
|
|
11
|
-
devices: [],
|
|
12
|
-
creationTime: {type: Date, default: Date.now},
|
|
13
|
-
lastUpdateTime: {type: Date, default: Date.now},
|
|
14
|
-
comments: String,
|
|
15
|
-
state: {type: String, default: StateEnum.ACTIVE}
|
|
16
|
-
},
|
|
17
|
-
{ collection: 'testDeviceCluster' }
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
// optional mongoose
|
|
21
|
-
let model = (mongooseInstance) => {
|
|
22
|
-
let TestDeviceCluster
|
|
23
|
-
if (mongooseInstance) {
|
|
24
|
-
TestDeviceCluster = mongooseInstance.model('TestDeviceCluster', TestDeviceClusterSchema)
|
|
25
|
-
} else {
|
|
26
|
-
TestDeviceCluster = mongoose.model('TestDeviceCluster', TestDeviceClusterSchema)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return TestDeviceCluster
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = { Model: model, Schema: TestDeviceClusterSchema }
|
package/models/TestInstance.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Andrew on 02/03/2017.
|
|
3
|
-
* Copyright : Bluedot Innovation.
|
|
4
|
-
*/
|
|
5
|
-
let mongoose = require('mongoose')
|
|
6
|
-
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
7
|
-
let TestStatusEnum = require('@bluedot-innovation/enums').TestStatusEnum
|
|
8
|
-
|
|
9
|
-
const Schema = mongoose.Schema
|
|
10
|
-
let Scenario = require('./TestScenario').Schema
|
|
11
|
-
|
|
12
|
-
let TestInstanceSchema = new mongoose.Schema(
|
|
13
|
-
{
|
|
14
|
-
name: String,
|
|
15
|
-
scenarioId: String,
|
|
16
|
-
devices: {},
|
|
17
|
-
clusters: {type: Array, default: []},
|
|
18
|
-
mode: String,
|
|
19
|
-
startTime: Date,
|
|
20
|
-
endTime: Date,
|
|
21
|
-
duration: Number,
|
|
22
|
-
endPoint: String,
|
|
23
|
-
trackedLocations: {type: Array, default: []},
|
|
24
|
-
creationTime: {type: Date, default: Date.now},
|
|
25
|
-
lastUpdateTime: {type: Date, default: Date.now},
|
|
26
|
-
state: {type: String, default: StateEnum.ACTIVE},
|
|
27
|
-
status: {type: String, default: TestStatusEnum.PLANNED},
|
|
28
|
-
isValid: {type: Boolean, default: true},
|
|
29
|
-
comments: String,
|
|
30
|
-
isProduction: Boolean,
|
|
31
|
-
enableBackgroundLocationIndicator: {type: Boolean, default: false},
|
|
32
|
-
enableForegroundService: {type: Boolean, default: true},
|
|
33
|
-
sdkVersion: String,
|
|
34
|
-
sdkBuildNumber: String,
|
|
35
|
-
platform: String,
|
|
36
|
-
appVersion: String,
|
|
37
|
-
buildType: String,
|
|
38
|
-
locationPermission: String,
|
|
39
|
-
roundNumber: Number,
|
|
40
|
-
useCaseType: String,
|
|
41
|
-
groupOfDevices: String,
|
|
42
|
-
configurationParameters:{type: Schema.Types.Mixed, default: null},
|
|
43
|
-
scenario: Scenario
|
|
44
|
-
},
|
|
45
|
-
{ collection: 'testInstance' }
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
// optional mongoose
|
|
49
|
-
let model = (mongooseInstance) => {
|
|
50
|
-
let TestInstance
|
|
51
|
-
if (mongooseInstance) {
|
|
52
|
-
TestInstance = mongooseInstance.model('TestInstance', TestInstanceSchema)
|
|
53
|
-
} else {
|
|
54
|
-
TestInstance = mongoose.model('TestInstance', TestInstanceSchema)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return TestInstance
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
module.exports = { Model: model, Schema: TestInstanceSchema }
|
package/models/TestScenario.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Andrew on 02/03/2017.
|
|
3
|
-
* Copyright : Bluedot Innovations.
|
|
4
|
-
* Owner :
|
|
5
|
-
*/
|
|
6
|
-
let mongoose = require('mongoose')
|
|
7
|
-
let StateEnum = require('@bluedot-innovation/enums').StateEnum
|
|
8
|
-
|
|
9
|
-
let TestScenarioSchema = new mongoose.Schema(
|
|
10
|
-
{
|
|
11
|
-
name: String,
|
|
12
|
-
apiKey: String,
|
|
13
|
-
customerApiKey: String,
|
|
14
|
-
email: String,
|
|
15
|
-
creationTime: {type: Date, default: Date.now},
|
|
16
|
-
lastUpdateTime: {type: Date, default: Date.now},
|
|
17
|
-
state: {type: String, default: StateEnum.ACTIVE},
|
|
18
|
-
numberZones: String,
|
|
19
|
-
comments: String,
|
|
20
|
-
environment: String,
|
|
21
|
-
accountId: String,
|
|
22
|
-
projectId: String,
|
|
23
|
-
zones: []
|
|
24
|
-
},
|
|
25
|
-
{ collection: 'testScenario' }
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
// optional mongoose
|
|
29
|
-
let model = (mongooseInstance) => {
|
|
30
|
-
let TestScenario
|
|
31
|
-
if (mongooseInstance) {
|
|
32
|
-
TestScenario = mongooseInstance.model('TestScenario', TestScenarioSchema)
|
|
33
|
-
} else {
|
|
34
|
-
TestScenario = mongoose.model('TestScenario', TestScenarioSchema)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return TestScenario
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
module.exports = { Model: model, Schema: TestScenarioSchema }
|