Socket
Socket
Sign inDemoInstall

agilite

Package Overview
Dependencies
132
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.3.14 to 7.3.15

.eslintrc.json

24

data-templates/batchActions.js

@@ -13,7 +13,9 @@ const data = {

parentId: null,
actions: [{
actionType: 'connectors/execute',
profileKey: 'key',
routeKey: 'route'
}]
actions: [
{
actionType: 'connectors/execute',
profileKey: 'key',
routeKey: 'route'
}
]
}

@@ -28,7 +30,9 @@ },

parentId: null,
actions: [{
actionType: 'connectors/execute',
profileKey: 'key_modified',
routeKey: 'route_modified'
}]
actions: [
{
actionType: 'connectors/execute',
profileKey: 'key_modified',
routeKey: 'route_modified'
}
]
}

@@ -35,0 +39,0 @@ }

const data = {
successfulLog: {
category: 'Error Log',
subCategory: 'Batch Logging Test',
code: 400,
message: 'This is a test error log'
},
emptyObject: {},

@@ -6,2 +12,9 @@ emptyDataObject: {

},
bodyObject: {
message: 'You have successfully found your weather',
values: {
city: 'Midrand',
degrees: 40
}
},
new: {

@@ -8,0 +21,0 @@ data: {

@@ -20,2 +20,3 @@ const data = {

appUrl: 'App URL',
lockedExpiry: 0,
referenceUrl: 'www.referenceURL.com',

@@ -26,87 +27,89 @@ appAdmin: 'App Admin',

keywords: [],
processSteps: [{
_id: 'temp_id',
isNewEntry: true,
isActive: true,
stepType: 'First Step',
key: 'first_step',
name: 'First Step',
description: 'Auto Generated First Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Draft',
responsibility: '1',
responsibleRole: 'Originator',
eventStamp: [{ value: 'DateCreated' }],
roleLevels: [],
visibleObjects: [],
stepOptions: [{
_id: '',
isNewEntry: false,
processSteps: [
{
_id: 'temp_id',
isActive: true,
key: 'submit',
name: 'Submit',
description: 'Auto Generated Option. This can be modified',
eventStamp: [{ value: 'DateSubmitted' }],
nextStep: 'completed_step',
stepType: 'First Step',
key: 'first_step',
name: 'First Step',
description: 'Auto Generated First Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Draft',
responsibility: '1',
responsibleRole: 'Originator',
eventStamp: [{ value: 'DateCreated' }],
roleLevels: [],
visibleObjects: [],
stepOptions: [
{
_id: '',
isActive: true,
key: 'submit',
name: 'Submit',
description: 'Auto Generated Option. This can be modified',
eventStamp: [{ value: 'DateSubmitted' }],
nextStep: 'completed_step',
visibleObjects: [],
notes: '',
iln: {
name: {
en: 'Submit'
},
description: {
en: 'Auto Generated Option. This can be modified'
}
},
keywords: []
}
],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'Submit'
en: 'First Step'
},
description: {
en: 'Auto Generated Option. This can be modified'
en: 'Auto Generated First Step. This can be modified'
},
processStage: {
en: 'Draft'
}
},
keywords: []
}],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'First Step'
},
description: {
en: 'Auto Generated First Step. This can be modified'
},
processStage: {
en: 'Draft'
}
},
keywords: []
}, {
_id: '',
isNewEntry: true,
isActive: true,
stepType: 'Completed Step',
key: 'completed_step',
name: 'Completed Step',
description: 'Auto Generated Completed Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Completion',
responsibility: '1',
responsibleRole: 'Verifier',
eventStamp: [{ value: 'DateCompleted' }],
roleLevels: [],
visibleObjects: [],
stepOptions: [],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'Completed Step'
{
_id: '',
isActive: true,
stepType: 'Completed Step',
key: 'completed_step',
name: 'Completed Step',
description: 'Auto Generated Completed Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Completion',
responsibility: '1',
responsibleRole: 'Verifier',
eventStamp: [{ value: 'DateCompleted' }],
roleLevels: [],
visibleObjects: [],
stepOptions: [],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'Completed Step'
},
description: {
en: 'Auto Generated Completed Step. This can be modified'
},
processStage: {
en: 'Completion'
}
},
description: {
en: 'Auto Generated Completed Step. This can be modified'
},
processStage: {
en: 'Completion'
}
},
keywords: []
}],
keywords: []
}
],
numberingId: ''

@@ -128,240 +131,269 @@ }

keywords: [],
processSteps: [{
_id: '',
isNewEntry: true,
isActive: true,
stepType: 'First Step',
key: 'first_step',
name: 'First Step',
description: 'Auto Generated First Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Draft',
responsibility: '1',
responsibleRole: 'Originator',
eventStamp: [{ value: 'DateCreated' }],
roleLevels: [],
visibleObjects: [{
id: 'choices',
isEditable: false,
isMandatory: false,
inputOptions: {
label: 'choices_label',
inputType: 'choice',
choices: [{
label: 'choice_label1',
value: 'choice_value1',
iln: {
label: {
en: 'choice_label1',
af: 'iln_label1'
}
}
}, {
label: 'choice_label2',
value: 'choice_value2',
iln: {
label: {
en: 'choice_label2',
af: 'iln_label2'
}
}
}, {
label: 'choice_label3',
value: 'choice_value3',
iln: {
label: {
en: 'choice_label3',
af: 'iln_label3'
}
}
}],
messages: [{
value: 'Choices Message',
iln: {
value: {
en: 'Choices Message',
af: 'iln_choices_message'
}
}
}],
iln: {
label: {
en: 'choices',
af: 'iln_choices'
}
}
}
}],
stepOptions: [{
processSteps: [
{
_id: '',
isNewEntry: false,
isNewEntry: true,
isActive: true,
key: 'submit',
name: 'Submit',
description: 'Auto Generated Option. This can be modified',
eventStamp: [{ value: 'DateSubmitted' }],
nextStep: 'completed_step',
visibleObjects: [{
id: 'choices',
isEditable: false,
isMandatory: false,
inputOptions: {
label: 'choices_label',
inputType: 'choice',
choices: [{
label: 'choice_label1',
value: 'choice_value1',
iln: {
label: {
en: 'choice_label1',
af: 'iln_label1'
stepType: 'First Step',
key: 'first_step',
name: 'First Step',
description: 'Auto Generated First Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Draft',
responsibility: '1',
responsibleRole: 'Originator',
eventStamp: [{ value: 'DateCreated' }],
roleLevels: [],
visibleObjects: [
{
id: 'choices',
isEditable: false,
isMandatory: false,
inputOptions: {
label: 'choices_label',
inputType: 'choice',
choices: [
{
label: 'choice_label1',
value: 'choice_value1',
iln: {
label: {
en: 'choice_label1',
af: 'iln_label1'
}
}
},
{
label: 'choice_label2',
value: 'choice_value2',
iln: {
label: {
en: 'choice_label2',
af: 'iln_label2'
}
}
},
{
label: 'choice_label3',
value: 'choice_value3',
iln: {
label: {
en: 'choice_label3',
af: 'iln_label3'
}
}
}
}
}, {
label: 'choice_label2',
value: 'choice_value2',
iln: {
label: {
en: 'choice_label2',
af: 'iln_label2'
],
messages: [
{
value: 'Choices Message',
iln: {
value: {
en: 'Choices Message',
af: 'iln_choices_message'
}
}
}
}
}, {
label: 'choice_label3',
value: 'choice_value3',
],
iln: {
label: {
en: 'choice_label3',
af: 'iln_label3'
en: 'choices',
af: 'iln_choices'
}
}
}],
messages: [{
value: 'Choices Message',
iln: {
value: {
en: 'Choices Message',
af: 'iln_choices_message'
}
}
],
stepOptions: [
{
_id: '',
isNewEntry: false,
isActive: true,
key: 'submit',
name: 'Submit',
description: 'Auto Generated Option. This can be modified',
eventStamp: [{ value: 'DateSubmitted' }],
nextStep: 'completed_step',
visibleObjects: [
{
id: 'choices',
isEditable: false,
isMandatory: false,
inputOptions: {
label: 'choices_label',
inputType: 'choice',
choices: [
{
label: 'choice_label1',
value: 'choice_value1',
iln: {
label: {
en: 'choice_label1',
af: 'iln_label1'
}
}
},
{
label: 'choice_label2',
value: 'choice_value2',
iln: {
label: {
en: 'choice_label2',
af: 'iln_label2'
}
}
},
{
label: 'choice_label3',
value: 'choice_value3',
iln: {
label: {
en: 'choice_label3',
af: 'iln_label3'
}
}
}
],
messages: [
{
value: 'Choices Message',
iln: {
value: {
en: 'Choices Message',
af: 'iln_choices_message'
}
}
}
],
iln: {
label: {
en: 'choices',
af: 'iln_choices'
}
}
}
}
}],
],
notes: '',
iln: {
label: {
en: 'choices',
af: 'iln_choices'
name: {
en: 'Submit'
},
description: {
en: 'Auto Generated Option. This can be modified'
}
}
},
keywords: []
}
}],
],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'Submit'
en: 'First Step'
},
description: {
en: 'Auto Generated Option. This can be modified'
en: 'Auto Generated First Step. This can be modified'
},
processStage: {
en: 'Draft'
}
},
keywords: []
}],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'First Step'
},
description: {
en: 'Auto Generated First Step. This can be modified'
},
processStage: {
en: 'Draft'
}
},
keywords: []
}, {
_id: '',
isNewEntry: true,
isActive: true,
stepType: 'Completed Step',
key: 'completed_step',
name: 'Completed Step',
description: 'Auto Generated Completed Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Completion',
responsibility: '1',
responsibleRole: 'Verifier',
eventStamp: [{ value: 'DateCompleted' }],
roleLevels: [],
visibleObjects: [{
id: 'choices',
isEditable: false,
isMandatory: false,
inputOptions: {
label: 'choices_label',
inputType: 'choice',
choices: [{
label: 'choice_label1',
value: 'choice_value1',
iln: {
label: {
en: 'choice_label1',
af: 'iln_label1'
{
_id: '',
isNewEntry: true,
isActive: true,
stepType: 'Completed Step',
key: 'completed_step',
name: 'Completed Step',
description: 'Auto Generated Completed Step. This can be modified',
instructions: '',
duration: '0',
processStage: 'Completion',
responsibility: '1',
responsibleRole: 'Verifier',
eventStamp: [{ value: 'DateCompleted' }],
roleLevels: [],
visibleObjects: [
{
id: 'choices',
isEditable: false,
isMandatory: false,
inputOptions: {
label: 'choices_label',
inputType: 'choice',
choices: [
{
label: 'choice_label1',
value: 'choice_value1',
iln: {
label: {
en: 'choice_label1',
af: 'iln_label1'
}
}
},
{
label: 'choice_label2',
value: 'choice_value2',
iln: {
label: {
en: 'choice_label2',
af: 'iln_label2'
}
}
},
{
label: 'choice_label3',
value: 'choice_value3',
iln: {
label: {
en: 'choice_label3',
af: 'iln_label3'
}
}
}
],
messages: [
{
value: 'Choices Message',
iln: {
value: {
en: 'Choices Message',
af: 'iln_choices_message'
}
}
}
],
iln: {
label: {
en: 'choices',
af: 'iln_choices'
}
}
}
}, {
label: 'choice_label2',
value: 'choice_value2',
iln: {
label: {
en: 'choice_label2',
af: 'iln_label2'
}
}
}, {
label: 'choice_label3',
value: 'choice_value3',
iln: {
label: {
en: 'choice_label3',
af: 'iln_label3'
}
}
}],
messages: [{
value: 'Choices Message',
iln: {
value: {
en: 'Choices Message',
af: 'iln_choices_message'
}
}
}],
iln: {
label: {
en: 'choices',
af: 'iln_choices'
}
}
}
}],
stepOptions: [],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'Completed Step'
],
stepOptions: [],
notes: '',
referenceUrl: '',
notificationTemplate: '',
iln: {
name: {
en: 'Completed Step'
},
description: {
en: 'Auto Generated Completed Step. This can be modified'
},
processStage: {
en: 'Completion'
}
},
description: {
en: 'Auto Generated Completed Step. This can be modified'
},
processStage: {
en: 'Completion'
}
},
keywords: []
}],
keywords: []
}
],
numberingId: '',

@@ -368,0 +400,0 @@ iln: {

@@ -15,3 +15,9 @@ const data = {

queryParams: [],
headerParams: [],
headerParams: [
{
paramKey: 'api-key',
paramValue:
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiI2MDVjNzNlYmMxN2YwMjAwMThlMGRiMzkiLCJ0ZWFtSWQiOiJhZ2lsaXRlX3Rlc3RpbmciLCJlbnRpdHlJZCI6bnVsbCwidGltZXN0YW1wIjoiMjAyMS0xMC0xNlQwNjo1ODowMi40NDRaIn0.kOKfBYurWy5TaMlSZmc-23Nj5dtjxzdNR8LbCdNioY0'
}
],
url: 'https://apidemo.agilite.io', // 'http://127.0.0.1:6010'

@@ -80,18 +86,20 @@ body: ''

},
routes: [{
_id: '',
isNewEntry: false,
isActive: true,
key: 'ping',
name: 'Ping',
description: '',
routeData: {
requestType: 'get',
responseIsFile: '0',
routePath: '/ping',
queryParams: [],
headerParams: [],
body: ''
routes: [
{
_id: '',
isNewEntry: false,
isActive: true,
key: 'ping',
name: 'Ping',
description: '',
routeData: {
requestType: 'get',
responseIsFile: '0',
routePath: '/ping',
queryParams: [],
headerParams: [],
body: ''
}
}
}],
],
isActive: true,

@@ -173,18 +181,20 @@ key: '',

},
routes: [{
_id: '',
isNewEntry: false,
isActive: true,
key: 'ping',
name: 'Ping',
description: '',
routeData: {
requestType: 'get',
responseIsFile: '0',
routePath: '/ping',
queryParams: [],
headerParams: [],
body: ''
routes: [
{
_id: '',
isNewEntry: false,
isActive: true,
key: 'ping',
name: 'Ping',
description: '',
routeData: {
requestType: 'get',
responseIsFile: '0',
routePath: '/ping',
queryParams: [],
headerParams: [],
body: ''
}
}
}],
],
isActive: true,

@@ -191,0 +201,0 @@ key: '',

@@ -13,34 +13,35 @@ const data = {

data: {
fieldMappings: [{
_id: '1548939344994',
isActive: true,
isParentMulti: false,
name: 'Param1',
description: '',
srcPath: '',
srcName: 'param1',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam1',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
},
{
_id: '1548939334660',
isActive: true,
isParentMulti: false,
name: 'Param2',
description: '',
srcPath: '',
srcName: 'param2',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam2',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
}
fieldMappings: [
{
_id: '1548939344994',
isActive: true,
isParentMulti: false,
name: 'Param1',
description: '',
srcPath: '',
srcName: 'param1',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam1',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
},
{
_id: '1548939334660',
isActive: true,
isParentMulti: false,
name: 'Param2',
description: '',
srcPath: '',
srcName: 'param2',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam2',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
}
],

@@ -79,34 +80,35 @@ multiEntryProfiles: [],

data: {
fieldMappings: [{
_id: '1548939344994',
isActive: true,
isParentMulti: false,
name: 'Param1',
description: '',
srcPath: '',
srcName: 'param1',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam1',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
},
{
_id: '1548939334660',
isActive: true,
isParentMulti: false,
name: 'Param2',
description: '',
srcPath: '',
srcName: 'param2',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam2',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
}
fieldMappings: [
{
_id: '1548939344994',
isActive: true,
isParentMulti: false,
name: 'Param1',
description: '',
srcPath: '',
srcName: 'param1',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam1',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
},
{
_id: '1548939334660',
isActive: true,
isParentMulti: false,
name: 'Param2',
description: '',
srcPath: '',
srcName: 'param2',
srcType: '1',
srcNotes: '',
desPath: '',
desName: 'desParam2',
desType: '1',
desNotes: '',
isActiveDescription: 'Yes'
}
],

@@ -113,0 +115,0 @@ multiEntryProfiles: [],

@@ -45,6 +45,8 @@ const data = {

key: '',
values: [{
label: 'key1',
value: 'value1'
}]
values: [
{
label: 'key1',
value: 'value1'
}
]
}

@@ -56,6 +58,12 @@ },

groupName: '',
values: [{
label: 'key11',
value: 'value11'
}]
values: [
{
label: 'key11',
value: 'value11'
},
{
label: 'key12',
value: 'value12'
}
]
}

@@ -62,0 +70,0 @@ }

@@ -45,6 +45,8 @@ const data = {

key: '',
values: [{
label: 'key1',
value: 'value1'
}]
values: [
{
label: 'key1',
value: 'value1'
}
]
}

@@ -57,25 +59,29 @@ },

notes: 'Tier 1 Notes',
values: [{
label: 'key1',
value: 'value1'
},
{
label: 'key2',
value: 'value2'
}
],
tierEntries: [{
key: 'tier2',
description: 'This is Tier 2',
notes: 'Tier 2 Notes',
values: [{
label: 'key11',
value: 'value11'
values: [
{
label: 'key1',
value: 'value1'
},
{
label: 'key22',
value: 'value22'
label: 'key2',
value: 'value2'
}
]
}]
],
tierEntries: [
{
key: 'tier2',
description: 'This is Tier 2',
notes: 'Tier 2 Notes',
values: [
{
label: 'key11',
value: 'value11'
},
{
label: 'key22',
value: 'value22'
}
]
}
]
}

@@ -82,0 +88,0 @@ }

@@ -5,3 +5,3 @@ # API Keys

* recordId - The Id of the API Key record
- recordId - The Id of the API Key record

@@ -14,3 +14,3 @@ ```javascript

* recordId - The Id of the API Key record
- recordId - The Id of the API Key record

@@ -23,3 +23,3 @@ ```javascript

* recordId - The Id of the API Key record
- recordId - The Id of the API Key record

@@ -32,3 +32,3 @@ ```javascript

* recordId - The Id of the API Key record
- recordId - The Id of the API Key record

@@ -41,6 +41,6 @@ ```javascript

* recordId - The Id of the API Key record
- recordId - The Id of the API Key record
```javascript
agilite.ApiKeys.enableApiKey(recordId)
```
```

@@ -5,4 +5,4 @@ # BPM

* processKey - The Key of the BPM Process
* currentUser - The Current User registering a BPM Record
- processKey - The Key of the BPM Process
- currentUser - The Current User registering a BPM Record

@@ -15,8 +15,8 @@ ```javascript

* processKey - The Key of the BPM Process
* bpmRecordId - The Id of the Registered BPM Record
* optionSelected - The selected option of the BPM Profile. e.g. "submit"
* currentUser - The Current User executing the Process
* comments - Additional Comments
* data - Optional request body data
- processKey - The Key of the BPM Process
- bpmRecordId - The Id of the Registered BPM Record
- optionSelected - The selected option of the BPM Profile. e.g. "submit"
- currentUser - The Current User executing the Process
- comments - Additional Comments
- data - Optional request body data

@@ -29,13 +29,24 @@ ```javascript

* processKeys - **Array** of ProcessKeys
* bpmRecordIds - **Array** of BPM Record Ids
* stepNames - **Array** of Step Names
* responsibleUsers - **Array** of Responsible Users
* relevantUsers - **Array** of Relevant Users
* includeHistory - Default: true
* includeStepOptions - Default: true
* includeVisibleObjects - Default: true
- processKeys - **Array** of ProcessKeys
- bpmRecordIds - **Array** of BPM Record Ids
- stepNames - **Array** of Step Names
- responsibleUsers - **Array** of Responsible Users
- relevantUsers - **Array** of Relevant Users
- includeHistory - Default: true
- includeStepOptions - Default: true
- includeVisibleObjects - Default: true
```javascript
agilite.BPM.getRecordState(processKeys, bpmRecordIds, stepNames, responsibleUsers, relevantUsers, includeHistory, includeStepOptions, includeVisibleObjects, page, pageLimit)
agilite.BPM.getRecordState(
processKeys,
bpmRecordIds,
stepNames,
responsibleUsers,
relevantUsers,
includeHistory,
includeStepOptions,
includeVisibleObjects,
page,
pageLimit
)
```

@@ -45,3 +56,3 @@

* profileKey - Profile Key to return
- profileKey - Profile Key to return

@@ -54,3 +65,3 @@ ```javascript

* profileKey - Profile Key of Profile History to clear
- profileKey - Profile Key of Profile History to clear

@@ -63,3 +74,3 @@ ```javascript

* processKey
- processKey

@@ -72,3 +83,3 @@ ```javascript

* processKey
- processKey

@@ -78,3 +89,1 @@ ```javascript

```

@@ -5,8 +5,8 @@ # Connectors

* profileKey - The Profile Key of the Connector Profile
* routeKey - The Route Key of Connector Profile
* data - Optional request body data
- profileKey - The Profile Key of the Connector Profile
- routeKey - The Route Key of Connector Profile
- data - Optional request body data
```javascript
agilite.Connectors.execute(profileKey, routeKey, data)
```
```

@@ -5,7 +5,7 @@ # Data Mapping

* profileKey - The Profile Key of the Connector Profile
* data - Optional request body data
- profileKey - The Profile Key of the Connector Profile
- data - Optional request body data
```javascript
agilite.DataMappings.execute(profileKey, data)
```
```

@@ -5,4 +5,4 @@ # Files

* recordId - The Id of the file to return
* responseType - Default arraybuffer - blob, document, json, text or stream
- recordId - The Id of the file to return
- responseType - Default arraybuffer - blob, document, json, text or stream

@@ -15,5 +15,5 @@ ```javascript

* fileName - File Name
* contentType - Content Type of the file
* data - The file data
- fileName - File Name
- contentType - Content Type of the file
- data - The file data

@@ -26,3 +26,3 @@ ```javascript

* recordId - Record Id of the file to delte
- recordId - Record Id of the file to delte

@@ -35,3 +35,3 @@ ```javascript

* recordId - Record Id of the file
- recordId - Record Id of the file

@@ -44,3 +44,3 @@ ```javascript

* recordId - Record Id of the file that needs to be unzipped
- recordId - Record Id of the file that needs to be unzipped

@@ -50,2 +50,1 @@ ```javascript

```

@@ -5,5 +5,5 @@ # Keywords

* profileKey - The Profile Key to return
* sort - Sort the Values - Label: asc/desc - Value: asc_value/desc_value
* outputFormat - Format of the response: array/json
- profileKey - The Profile Key to return
- sort - Sort the Values - Label: asc/desc - Value: asc_value/desc_value
- outputFormat - Format of the response: array/json

@@ -16,4 +16,4 @@ ```javascript

* groupName - The GroupName of Keyword Profile Keys to return
* sort - Sort the Profile Keys: asc/desc
- groupName - The GroupName of Keyword Profile Keys to return
- sort - Sort the Profile Keys: asc/desc

@@ -26,5 +26,5 @@ ```javascript

* profileKey - The Profile Key of the Profile
* value - Keyword Value
* outputFormat - Format of the response: string/json
- profileKey - The Profile Key of the Profile
- value - Keyword Value
- outputFormat - Format of the response: string/json

@@ -37,8 +37,8 @@ ```javascript

* profileKey - The Profile Key of the Profile
* label - Keyword Label
* outputFormat - Format of the response: string/json
- profileKey - The Profile Key of the Profile
- label - Keyword Label
- outputFormat - Format of the response: string/json
```javascript
agilite.Keywords.getValueByLabel(profileKey, label, outputFormat)
```
```

@@ -5,5 +5,5 @@ # Numbering

* profileKey - The Profile Key to return
* outputFormat - Format of the response: string/json
* data - Optional request body data
- profileKey - The Profile Key to return
- outputFormat - Format of the response: string/json
- data - Optional request body data

@@ -16,6 +16,6 @@ ```javascript

* recordId - The Record Id of the Profile's Numbering Counters to reset
- recordId - The Record Id of the Profile's Numbering Counters to reset
```javascript
agilite.Numbering.resetCounters(recordId)
```
```

@@ -5,5 +5,5 @@ # Roles

* roleNames - **Array** of Role Names to return
* conditionalLevels - **Array** of Conditional Levels to return
* data - Optional request body data
- roleNames - **Array** of Role Names to return
- conditionalLevels - **Array** of Conditional Levels to return
- data - Optional request body data

@@ -16,7 +16,7 @@ ```javascript

* processKey - Key of the related BPM Process
* bpmRecordId - Record Id of the registered BPM Record
* roleName - Name of the Role
* currentUser - Current User assigning the role
* responsibleUsers - **Array** of responsibleUsers
- processKey - Key of the related BPM Process
- bpmRecordId - Record Id of the registered BPM Record
- roleName - Name of the Role
- currentUser - Current User assigning the role
- responsibleUsers - **Array** of responsibleUsers

@@ -29,5 +29,5 @@ ```javascript

* processKey - Key of the related BPM Process
* bpmRecordId - Record Id of the registered BPM Record
* roleNames - **Array** of Role Names to return
- processKey - Key of the related BPM Process
- bpmRecordId - Record Id of the registered BPM Record
- roleNames - **Array** of Role Names to return

@@ -40,4 +40,4 @@ ```javascript

* recordId - Record Id of the Role Profile
* conditionalLevels - **Array** of new Conditional Levels
- recordId - Record Id of the Role Profile
- conditionalLevels - **Array** of new Conditional Levels

@@ -50,7 +50,7 @@ ```javascript

* recordId - Record Id of the Role Profile
* responsibleUser - New Responsible User
- recordId - Record Id of the Role Profile
- responsibleUser - New Responsible User
```javascript
agilite.Roles.reAssignResponsibleUser(recordId, responsibleUser)
```
```

@@ -5,7 +5,7 @@ # Templates

* profileKey - Profile Key of Template Profile to execute
* data - Optional request body data
- profileKey - Profile Key of Template Profile to execute
- data - Optional request body data
```javascript
agilite.Templates.execute(profileKey, data)
```
```

@@ -5,11 +5,18 @@ # Tier Structures

* tierKeys - **Array** of Tier Keys to return
* includeValues - Default true
* includeMetaData - Default true
* includeTierEntries - Default true
* sortValues - Sort Values asc/desc
* valuesOutputFormat - Output Format of Values - array/json/string
- tierKeys - **Array** of Tier Keys to return
- includeValues - Default true
- includeMetaData - Default true
- includeTierEntries - Default true
- sortValues - Sort Values asc/desc
- valuesOutputFormat - Output Format of Values - array/json/string
```javascript
agilite.TierStructures.getTierByKey(tierKeys, includeValues, includeMetaData, includeTierEntries, sortValues, valuesOutputFormat)
```
agilite.TierStructures.getTierByKey(
tierKeys,
includeValues,
includeMetaData,
includeTierEntries,
sortValues,
valuesOutputFormat
)
```

@@ -5,3 +5,3 @@ # Utilities

* data - XML Data
- data - XML Data

@@ -14,3 +14,3 @@ ```javascript

* data - XML Data
- data - XML Data

@@ -23,3 +23,3 @@ ```javascript

* data - XML Data
- data - XML Data

@@ -32,3 +32,3 @@ ```javascript

* data - JS Data
- data - JS Data

@@ -41,3 +41,3 @@ ```javascript

* data - HTML Data
- data - HTML Data

@@ -50,3 +50,3 @@ ```javascript

* data - PDF Data
- data - PDF Data

@@ -65,7 +65,7 @@ ```javascript

* dateTimeValue - The Actual Date/Time to be formatted
* formatKey - The required Format of the Date/Time value e.g. YYYY/MM/DD
- dateTimeValue - The Actual Date/Time to be formatted
- formatKey - The required Format of the Date/Time value e.g. YYYY/MM/DD
```javascript
agilite.Utils.formatDateTime(dateTimeValue, formatKey)
```
```

@@ -16,3 +16,3 @@ 'use strict'

return new Promise((resolve, reject) => {
(async () => {
;(async () => {
const result = []

@@ -38,7 +38,9 @@ let tmpData = null

exports.execute = (test, agilite) => {
it(`-- AUTO: ${test.title}`, (done) => { // eslint-disable-line
it(`-- AUTO: ${test.title}`, (done) => {
// eslint-disable-line
switch (test.type) {
case Enums.testTypes.CREATE_POST_NEGATIVE:
agilite.executeCRUDRequest(test.moduleKey, test.method, test.data, test.headers)
.catch(err => {
agilite
.executeCRUDRequest(test.moduleKey, test.method, test.data, test.headers)
.catch((err) => {
expect(err).to.haveOwnProperty('response')

@@ -45,0 +47,0 @@ expect(err.response.status).to.equal(Enums.statusCodes.ERROR)

@@ -11,3 +11,3 @@ 'use strict'

return new Promise((resolve, reject) => {
(async () => {
;(async () => {
const result = []

@@ -27,3 +27,3 @@

type = Enums.testTypes.CREATE_POST_NEGATIVE
errMsg = 'No \'data\' property found in JSON Body'
errMsg = "No 'data' property found in JSON Body"

@@ -30,0 +30,0 @@ title = 'Create Record - Undefined Body Content (Negative)'

{
"name": "agilite",
"license": "MIT",
"version": "7.3.14",
"version": "7.3.15",
"description": "A NodeJS module that provides seamless interactions with Agilit-e APIs",

@@ -46,5 +46,5 @@ "homepage": "https://agilite.io",

"scripts": {
"test": "mocha",
"build": "standard && tsc",
"deploy": "npm publish"
"test": "mocha --reporter mochawesome",
"build": "npx prettier --write . && tsc",
"deploy": "npx prettier --check . && tsc && npm publish"
},

@@ -54,5 +54,6 @@ "devDependencies": {

"chai": "4.3.4",
"mocha": "8.3.2",
"standard": "16.0.3",
"ts-standard": "10.0.0",
"eslint": "7.32.0",
"mocha": "9.1.2",
"mochawesome": "6.3.1",
"prettier": "2.4.1",
"typescript": "4.2.3"

@@ -59,0 +60,0 @@ },

# agilite
A NodeJS module that provides seamless interactions with [Agilit-e](https://agilite.io) APIs.

@@ -17,16 +18,16 @@

```javascript
const Agilite = require('agilite');
const Agilite = require('agilite')
const agilite = new Agilite({
apiServerUrl: "{api_server_url}",
apiKey: "{agilite_api_key}"
});
apiServerUrl: '{api_server_url}',
apiKey: '{agilite_api_key}'
})
agilite.Keywords.getData()
.then((response) => {
console.log(response.data);
})
.catch((err) => {
console.log(err.response.data);
})
.then((response) => {
console.log(response.data)
})
.catch((err) => {
console.log(err.response.data)
})
```

@@ -41,2 +42,3 @@

# APIs
Every API returns a promise

@@ -48,3 +50,3 @@

* data - The request body data to post
- data - The request body data to post

@@ -57,5 +59,5 @@ ```javascript

* profileKeys - **Array** of Profile Keys to return
* recordIds - **Array** of Record Ids to return
* slimResult - Default: true, Only return data
- profileKeys - **Array** of Profile Keys to return
- recordIds - **Array** of Record Ids to return
- slimResult - Default: true, Only return data

@@ -68,4 +70,4 @@ ```javascript

* recordId - The Id of the record to PUT / Update
* data - The request body data to put
- recordId - The Id of the record to PUT / Update
- data - The request body data to put

@@ -78,3 +80,3 @@ ```javascript

* recordId - The Id of the record to DELETE / Remove
- recordId - The Id of the record to DELETE / Remove

@@ -87,6 +89,6 @@ ```javascript

* appName - The App Name relative to the Request. e.g. "keywords" or "numbering"
* reqType - The Request Type. e.g. "GET", "PUT"
* data - Optional request body data
* headers - Request Headers
- appName - The App Name relative to the Request. e.g. "keywords" or "numbering"
- reqType - The Request Type. e.g. "GET", "PUT"
- data - Optional request body data
- headers - Request Headers

@@ -97,13 +99,13 @@ ```javascript

## App APIs
## App APIs
* ### [API Keys](./docs/APIKEYS)
* ### [BPM](./docs/BPM)
* ### [Connectors](./docs/CONNECTORS)
* ### [Files](./docs/FILES)
* ### [Keywords](./docs/KEYWORDS)
* ### [Numbering](./docs/NUMBERING)
* ### [Roles](./docs/ROLES)
* ### [Templates](./docs/TEMPLATES)
* ### [Tier Structures](./docs/TIERSTRUCTURES)
* ### [Utilities](./docs/UTILS)
- ### [API Keys](./docs/APIKEYS)
- ### [BPM](./docs/BPM)
- ### [Connectors](./docs/CONNECTORS)
- ### [Files](./docs/FILES)
- ### [Keywords](./docs/KEYWORDS)
- ### [Numbering](./docs/NUMBERING)
- ### [Roles](./docs/ROLES)
- ### [Templates](./docs/TEMPLATES)
- ### [Tier Structures](./docs/TIERSTRUCTURES)
- ### [Utilities](./docs/UTILS)

@@ -32,2 +32,2 @@ export interface ConfigInterface {

DELETE: string
}
}

@@ -46,3 +46,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
this.config = {

@@ -99,11 +99,19 @@ apiServerUrl: config.apiServerUrl || Enums.URL_API_SERVER,

getConfig () {
getConfig() {
return this.config
}
executeCRUDRequest (appName: string = '', reqType: string = '', data: any = {}, headers: any = {}) {
return executeCRUDRequest(this.config.apiServerUrl, this.config.apiKey, this.config.teamId, appName, reqType, data, headers)
executeCRUDRequest(appName: string = '', reqType: string = '', data: any = {}, headers: any = {}) {
return executeCRUDRequest(
this.config.apiServerUrl,
this.config.apiKey,
this.config.teamId,
appName,
reqType,
data,
headers
)
}
authenticateToken (apiKey: string = '') {
authenticateToken(apiKey: string = '') {
return authenticateToken(this.config.apiServerUrl, apiKey)

@@ -110,0 +118,0 @@ }

@@ -12,3 +12,3 @@ import { Enums } from '../../utils/enums'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
this.outputFormat = {

@@ -26,20 +26,49 @@ JSON: Enums.VALUE_JSON_LOWER,

postData (data: any = {}) {
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ADMIN_SOLUTIONS, Enums.METHOD_POST, data)
postData(data: any = {}) {
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ADMIN_SOLUTIONS,
Enums.METHOD_POST,
data
)
}
getData () {
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ADMIN_SOLUTIONS, Enums.METHOD_GET)
getData() {
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ADMIN_SOLUTIONS,
Enums.METHOD_GET
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}) {
const headers: any = {}
headers[Enums.HEADER_RECORD_ID] = recordId
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ADMIN_SOLUTIONS, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ADMIN_SOLUTIONS,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY) {
const headers: any = {}
headers[Enums.HEADER_RECORD_ID] = recordId
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ADMIN_SOLUTIONS, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ADMIN_SOLUTIONS,
Enums.METHOD_DELETE,
null,
headers
)
}

@@ -46,0 +75,0 @@ }

@@ -11,3 +11,3 @@ import { Enums } from '../../utils/enums'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -20,7 +20,14 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}) {
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_API_KEYS, Enums.METHOD_POST, data)
postData(data: any = {}) {
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_API_KEYS,
Enums.METHOD_POST,
data
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true) {
getData(profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true) {
let headers: any = {}

@@ -32,20 +39,44 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_API_KEYS, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_API_KEYS,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}) {
let headers: any = {}
headers[Enums.HEADER_RECORD_ID] = recordId
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_API_KEYS, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_API_KEYS,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY) {
let headers: any = {}
headers[Enums.HEADER_RECORD_ID] = recordId
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_API_KEYS, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_API_KEYS,
Enums.METHOD_DELETE,
null,
headers
)
}
generateApiKey (recordId: string = Enums.STRING_EMPTY) {
generateApiKey(recordId: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -64,3 +95,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_API_KEYS}/${Enums.STRING_GENERATE}`,

resetApiKeys (recordId: string = Enums.STRING_EMPTY) {
resetApiKeys(recordId: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -79,3 +110,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_API_KEYS}/${Enums.STRING_RESET}`,

disableApiKey (recordId: string = Enums.STRING_EMPTY) {
disableApiKey(recordId: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -94,3 +125,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_API_KEYS}/${Enums.STRING_DISABLE}`,

enableApiKey (recordId: string = Enums.STRING_EMPTY) {
enableApiKey(recordId: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -97,0 +128,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_API_KEYS}/${Enums.STRING_ENABLE}`,

@@ -13,3 +13,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -22,10 +22,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_ACTIONS, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_ACTIONS,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
const headers: any = {}

@@ -38,6 +51,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_ACTIONS, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_ACTIONS,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
const headers: any = {}

@@ -48,6 +69,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_ACTIONS, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_ACTIONS,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
const headers: any = {}

@@ -58,6 +87,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_ACTIONS, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_ACTIONS,
Enums.METHOD_DELETE,
null,
headers
)
}
execute (profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
execute(profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
const config: AxiosInterface = {

@@ -64,0 +101,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BATCH_ACTIONS}/${Enums.STRING_EXECUTE}`,

@@ -14,3 +14,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
this.outputFormat = {

@@ -28,10 +28,23 @@ JSON: Enums.VALUE_JSON_LOWER,

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_LOGGING, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_LOGGING,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -44,6 +57,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_LOGGING, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_LOGGING,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -54,15 +75,31 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_LOGGING, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_LOGGING,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
headers[Enums.HEADER_RECORD_ID] = recordId
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BATCH_LOGGING, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BATCH_LOGGING,
Enums.METHOD_DELETE,
null,
headers
)
}
getByProfileKey (profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getByProfileKey(profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -82,3 +119,11 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BATCH_LOGGING}/${Enums.STRING_GET_BY_PROFILE_KEY}`,

createLogEntry (profileKey: string = Enums.STRING_EMPTY, category: string = Enums.STRING_EMPTY, subCategory: string = Enums.STRING_EMPTY, code: string = Enums.STRING_EMPTY, message: string = Enums.STRING_EMPTY, contentType: string = 'application/json', data: any = {}) {
createLogEntry(
profileKey: string = Enums.STRING_EMPTY,
category: string = Enums.STRING_EMPTY,
subCategory: string = Enums.STRING_EMPTY,
code: string = Enums.STRING_EMPTY,
message: string = Enums.STRING_EMPTY,
contentType: string = 'application/json',
data: any = {}
) {
let config: AxiosInterface = {

@@ -103,3 +148,10 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BATCH_LOGGING}/${Enums.STRING_CREATE_LOG_ENTRY}`,

getLogs (profileKey: string = Enums.STRING_EMPTY, qry: string = Enums.STRING_EMPTY, fieldsToReturn: string = Enums.STRING_EMPTY, qryOptions: any = null, page: any = null, pageLimit: any = null) {
getLogs(
profileKey: string = Enums.STRING_EMPTY,
qry: string = Enums.STRING_EMPTY,
fieldsToReturn: string = Enums.STRING_EMPTY,
qryOptions: any = null,
page: any = null,
pageLimit: any = null
) {
let config: AxiosInterface = {

@@ -124,3 +176,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BATCH_LOGGING}/${Enums.STRING_GET_LOGS}`,

resetLogs (profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
resetLogs(profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -127,0 +179,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BATCH_LOGGING}/${Enums.STRING_RESET_LOGS}`,

@@ -13,3 +13,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -22,10 +22,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BPM, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BPM,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -38,6 +51,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BPM, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BPM,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -48,6 +69,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BPM, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BPM,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -58,6 +87,23 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_BPM, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_BPM,
Enums.METHOD_DELETE,
null,
headers
)
}
registerBPMRecord (processKey: string = Enums.STRING_EMPTY, currentUser: string = Enums.STRING_EMPTY, includeHistory: boolean = true, includeStepOptions: boolean = true, includeVisibleObjects: boolean = true, includeKeywords: boolean = true, isoLanguage: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
registerBPMRecord(
processKey: string = Enums.STRING_EMPTY,
currentUser: string = Enums.STRING_EMPTY,
includeHistory: boolean = true,
includeStepOptions: boolean = true,
includeVisibleObjects: boolean = true,
includeKeywords: boolean = true,
isoLanguage: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -72,6 +118,10 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/registerBPMRecord`,

if (currentUser !== undefined && currentUser !== null) config.headers[Enums.HEADER_CURRENT_USER] = currentUser
if (includeHistory !== undefined && includeHistory !== null) config.headers[Enums.HEADER_INCLUDE_HISTORY] = includeHistory
if (includeStepOptions !== undefined && includeStepOptions !== null) config.headers[Enums.HEADER_INCLUDE_STEP_OPTIONS] = includeStepOptions
if (includeVisibleObjects !== undefined && includeVisibleObjects !== null) config.headers[Enums.HEADER_INCLUDE_VISIBLE_OBJECTS] = includeVisibleObjects
if (includeKeywords !== undefined && includeKeywords !== null) config.headers[Enums.HEADER_INCLUDE_KEYWORDS] = includeKeywords
if (includeHistory !== undefined && includeHistory !== null)
config.headers[Enums.HEADER_INCLUDE_HISTORY] = includeHistory
if (includeStepOptions !== undefined && includeStepOptions !== null)
config.headers[Enums.HEADER_INCLUDE_STEP_OPTIONS] = includeStepOptions
if (includeVisibleObjects !== undefined && includeVisibleObjects !== null)
config.headers[Enums.HEADER_INCLUDE_VISIBLE_OBJECTS] = includeVisibleObjects
if (includeKeywords !== undefined && includeKeywords !== null)
config.headers[Enums.HEADER_INCLUDE_KEYWORDS] = includeKeywords
if (isoLanguage) config.headers[Enums.HEADER_ISO_LANGUAGE] = isoLanguage

@@ -84,3 +134,17 @@ if (this.apiKey) config.headers[Enums.HEADER_API_KEY] = this.apiKey

execute (processKey: string = Enums.STRING_EMPTY, bpmRecordId: string = Enums.STRING_EMPTY, optionSelected: string = Enums.STRING_EMPTY, currentUser: string = Enums.STRING_EMPTY, currentStep: string = Enums.STRING_EMPTY, comments: string = Enums.STRING_EMPTY, data: any = {}, includeHistory: boolean = true, includeStepOptions: boolean = true, includeVisibleObjects: boolean = true, includeKeywords: boolean = true, isoLanguage: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
execute(
processKey: string = Enums.STRING_EMPTY,
bpmRecordId: string = Enums.STRING_EMPTY,
optionSelected: string = Enums.STRING_EMPTY,
currentUser: string = Enums.STRING_EMPTY,
currentStep: string = Enums.STRING_EMPTY,
comments: string = Enums.STRING_EMPTY,
data: any = {},
includeHistory: boolean = true,
includeStepOptions: boolean = true,
includeVisibleObjects: boolean = true,
includeKeywords: boolean = true,
isoLanguage: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -113,3 +177,22 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/${Enums.STRING_EXECUTE}`,

getRecordState (processKeys: Array<string> = [], bpmRecordIds: Array<string> = [], stepNames: Array<string> = [], responsibleUsers: Array<string> = [], relevantUsers: Array<string> = [], relevantRoles: Array<string> = [], eventStamps: Array<string> = [], eventStartDate: string = Enums.STRING_EMPTY, eventEndDate: string = Enums.STRING_EMPTY, includeHistory: boolean = true, includeStepOptions: boolean = true, includeVisibleObjects: boolean = true, includeKeywords: boolean = true, page: any = undefined, pageLimit: any = undefined, sort: string = Enums.STRING_EMPTY, isoLanguage: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getRecordState(
processKeys: Array<string> = [],
bpmRecordIds: Array<string> = [],
stepNames: Array<string> = [],
responsibleUsers: Array<string> = [],
relevantUsers: Array<string> = [],
relevantRoles: Array<string> = [],
eventStamps: Array<string> = [],
eventStartDate: string = Enums.STRING_EMPTY,
eventEndDate: string = Enums.STRING_EMPTY,
includeHistory: boolean = true,
includeStepOptions: boolean = true,
includeVisibleObjects: boolean = true,
includeKeywords: boolean = true,
page: any = undefined,
pageLimit: any = undefined,
sort: string = Enums.STRING_EMPTY,
isoLanguage: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -145,3 +228,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/getRecordState`,

getByProfileKey (profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getByProfileKey(profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -161,3 +244,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/getByProfileKey`,

clearHistoryData (profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
clearHistoryData(profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -177,3 +260,7 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/clearHistoryData`,

getActiveSteps (processKey: string = Enums.STRING_EMPTY, isoLanguage: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getActiveSteps(
processKey: string = Enums.STRING_EMPTY,
isoLanguage: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -194,3 +281,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/getActiveSteps`,

getActiveUsers (processKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getActiveUsers(processKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -210,3 +297,7 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/getActiveUsers`,

deleteBPMStubs (processKey: string = Enums.STRING_EMPTY, bpmRecordIds: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteBPMStubs(
processKey: string = Enums.STRING_EMPTY,
bpmRecordIds: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -227,3 +318,10 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/deleteBPMStubs`,

assignRole (processKey: string = Enums.STRING_EMPTY, bpmRecordId: string = Enums.STRING_EMPTY, roleName: string = Enums.STRING_EMPTY, currentUser: string = Enums.STRING_EMPTY, responsibleUsers: Array<string> = [], logProfileKey: string = Enums.STRING_EMPTY) {
assignRole(
processKey: string = Enums.STRING_EMPTY,
bpmRecordId: string = Enums.STRING_EMPTY,
roleName: string = Enums.STRING_EMPTY,
currentUser: string = Enums.STRING_EMPTY,
responsibleUsers: Array<string> = [],
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -247,3 +345,8 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/assignRole`,

getAssignedRoles (processKey: string = Enums.STRING_EMPTY, bpmRecordId: string = Enums.STRING_EMPTY, roleNames: Array<string> = [], logProfileKey: string = Enums.STRING_EMPTY) {
getAssignedRoles(
processKey: string = Enums.STRING_EMPTY,
bpmRecordId: string = Enums.STRING_EMPTY,
roleNames: Array<string> = [],
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -265,3 +368,9 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/getAssignedRoles`,

reAssignResponsibleUser (processKey: string = Enums.STRING_EMPTY, currentResponsibleUser: string = Enums.STRING_EMPTY, newResponsibleUser: string = Enums.STRING_EMPTY, roleNames: Array<string> = [], logProfileKey: string = Enums.STRING_EMPTY) {
reAssignResponsibleUser(
processKey: string = Enums.STRING_EMPTY,
currentResponsibleUser: string = Enums.STRING_EMPTY,
newResponsibleUser: string = Enums.STRING_EMPTY,
roleNames: Array<string> = [],
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -284,3 +393,7 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/reAssignResponsibleUser`,

getResponsibleRoles (processKey: string = Enums.STRING_EMPTY, responsibleUser: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getResponsibleRoles(
processKey: string = Enums.STRING_EMPTY,
responsibleUser: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -301,3 +414,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/getResponsibleRoles`,

lockRecord (bpmRecordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
lockRecord(bpmRecordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -317,3 +430,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/lockRecord`,

unlockRecord (bpmRecordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
unlockRecord(bpmRecordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -320,0 +433,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_BPM}/unlockRecord`,

@@ -13,3 +13,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -22,10 +22,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_CONNECTORS, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_CONNECTORS,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -38,6 +51,19 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_CONNECTORS, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_CONNECTORS,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, resetService: boolean = false, logProfileKey: string = Enums.STRING_EMPTY) {
putData(
recordId: string = Enums.STRING_EMPTY,
data: any = {},
resetService: boolean = false,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -49,6 +75,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_CONNECTORS, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_CONNECTORS,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -59,6 +93,20 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_CONNECTORS, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_CONNECTORS,
Enums.METHOD_DELETE,
null,
headers
)
}
execute (profileKey: string = Enums.STRING_EMPTY, routeKey: string = Enums.STRING_EMPTY, data: any = {}, isResponseFile: boolean = false, logProfileKey: string = Enums.STRING_EMPTY) {
execute(
profileKey: string = Enums.STRING_EMPTY,
routeKey: string = Enums.STRING_EMPTY,
data: any = {},
isResponseFile: boolean = false,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -82,3 +130,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_CONNECTORS}/${Enums.STRING_EXECUTE}`,

resetConnectionPool (profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
resetConnectionPool(profileKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -85,0 +133,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_CONNECTORS}/${Enums.STRING_RESET_CONNECTION_POOL}`,

@@ -13,3 +13,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -22,10 +22,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_DATA_MAPPING, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_DATA_MAPPING,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -38,6 +51,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_DATA_MAPPING, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_DATA_MAPPING,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -48,6 +69,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_DATA_MAPPING, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_DATA_MAPPING,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -58,6 +87,14 @@

if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_DATA_MAPPING, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_DATA_MAPPING,
Enums.METHOD_DELETE,
null,
headers
)
}
execute (profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
execute(profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -64,0 +101,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_DATA_MAPPING}/${Enums.STRING_EXECUTE}`,

@@ -13,3 +13,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -22,10 +22,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_EVENTS, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_EVENTS,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
const headers: any = {}

@@ -38,24 +51,48 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_EVENTS, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_EVENTS,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
const headers: any = {}
headers[Enums.HEADER_RECORD_ID] = recordId
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_EVENTS, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_EVENTS,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
const headers: any = {}
headers[Enums.HEADER_RECORD_ID] = recordId
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_EVENTS, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_EVENTS,
Enums.METHOD_DELETE,
null,
headers
)
}
execute (profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
execute(profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
const config: AxiosInterface = {

@@ -77,3 +114,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_EVENTS}/${Enums.STRING_EXECUTE}`,

subscribe (profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
subscribe(profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
const config: AxiosInterface = {

@@ -80,0 +117,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_EVENTS}/${Enums.STRING_SUBSCRIBE}`,

@@ -14,3 +14,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
this.responseType = {

@@ -32,3 +32,7 @@ ARRAY_BUFFER: 'arraybuffer',

getFile (recordId: string = Enums.STRING_EMPTY, responseType = this.responseType.ARRAY_BUFFER, logProfileKey: string = Enums.STRING_EMPTY) {
getFile(
recordId: string = Enums.STRING_EMPTY,
responseType = this.responseType.ARRAY_BUFFER,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -49,3 +53,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_FILES}`,

getPublicFile (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getPublicFile(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -65,3 +69,10 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_FILES}/${recordId}`,

uploadFile (fileName: string = Enums.STRING_EMPTY, contentType: string = Enums.STRING_EMPTY, data: any = {}, persistFile: boolean = false, isPublic: boolean = false, logProfileKey: string = Enums.STRING_EMPTY) {
uploadFile(
fileName: string = Enums.STRING_EMPTY,
contentType: string = Enums.STRING_EMPTY,
data: any = {},
persistFile: boolean = false,
isPublic: boolean = false,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -85,3 +96,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_FILES}`,

deleteFile (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteFile(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -101,3 +112,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_FILES}`,

getFileName (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getFileName(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -117,3 +128,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_FILES}/getFileName`,

unzip (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
unzip(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -120,0 +131,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_FILES}/unzip`,

@@ -12,5 +12,5 @@ import { Enums } from '../../utils/enums'

interface Sort {
ASC: string,
DESC: string,
ASC_VALUE: string,
ASC: string
DESC: string
ASC_VALUE: string
DESC_VALUE: string

@@ -20,3 +20,3 @@ }

interface Values {
label: string,
label: string
value: string

@@ -40,3 +40,3 @@ }

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -49,10 +49,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_KEYWORDS, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_KEYWORDS,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -65,6 +78,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_KEYWORDS, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_KEYWORDS,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -75,6 +96,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_KEYWORDS, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_KEYWORDS,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -85,6 +114,19 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_KEYWORDS, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_KEYWORDS,
Enums.METHOD_DELETE,
null,
headers
)
}
getValuesByProfileKey (profileKey: string = Enums.STRING_EMPTY, sort: string = Enums.STRING_EMPTY, outputFormat: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getValuesByProfileKey(
profileKey: string = Enums.STRING_EMPTY,
sort: string = Enums.STRING_EMPTY,
outputFormat: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -106,3 +148,7 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_KEYWORDS}/getValuesByProfileKey`,

setValuesByProfileKey (profileKey: string = Enums.STRING_EMPTY, values: Array<Values> = [], logProfileKey: string = Enums.STRING_EMPTY) {
setValuesByProfileKey(
profileKey: string = Enums.STRING_EMPTY,
values: Array<Values> = [],
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -124,3 +170,7 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_KEYWORDS}/setValuesByProfileKey`,

getProfileKeysByGroup (groupName: string = Enums.STRING_EMPTY, sort: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getProfileKeysByGroup(
groupName: string = Enums.STRING_EMPTY,
sort: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -141,3 +191,8 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_KEYWORDS}/getProfileKeysByGroup`,

getLabelByValue (profileKey: string = Enums.STRING_EMPTY, value: string = Enums.STRING_EMPTY, outputFormat: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getLabelByValue(
profileKey: string = Enums.STRING_EMPTY,
value: string = Enums.STRING_EMPTY,
outputFormat: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -159,3 +214,8 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_KEYWORDS}/getLabelByValue`,

setLabelByValue (profileKey: string = Enums.STRING_EMPTY, valueKey: string = Enums.STRING_EMPTY, label: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
setLabelByValue(
profileKey: string = Enums.STRING_EMPTY,
valueKey: string = Enums.STRING_EMPTY,
label: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -177,3 +237,8 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_KEYWORDS}/setLabelByValue`,

getValueByLabel (profileKey: string = Enums.STRING_EMPTY, label: string = Enums.STRING_EMPTY, outputFormat: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getValueByLabel(
profileKey: string = Enums.STRING_EMPTY,
label: string = Enums.STRING_EMPTY,
outputFormat: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -195,3 +260,8 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_KEYWORDS}/getValueByLabel`,

setValueByLabel (profileKey: string = Enums.STRING_EMPTY, labelKey: string = Enums.STRING_EMPTY, value: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
setValueByLabel(
profileKey: string = Enums.STRING_EMPTY,
labelKey: string = Enums.STRING_EMPTY,
value: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -198,0 +268,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_KEYWORDS}/setValueByLabel`,

@@ -13,3 +13,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -22,3 +22,3 @@ this.apiServerUrl = config.apiServerUrl

getFlows () {
getFlows() {
const config: AxiosInterface = {

@@ -35,3 +35,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/getFlows`,

saveFlows (data: any) {
saveFlows(data: any) {
const config: AxiosInterface = {

@@ -50,3 +50,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/saveFlows`,

getCredentials () {
getCredentials() {
const config: AxiosInterface = {

@@ -64,3 +64,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/getCredentials`,

saveCredentials (data: any) {
saveCredentials(data: any) {
const config: AxiosInterface = {

@@ -79,3 +79,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/saveCredentials`,

getSettings () {
getSettings() {
const config: AxiosInterface = {

@@ -93,3 +93,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/getSettings`,

saveSettings (data: any) {
saveSettings(data: any) {
const config: AxiosInterface = {

@@ -108,3 +108,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/saveSettings`,

getSessions () {
getSessions() {
const config: AxiosInterface = {

@@ -122,3 +122,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/getSessions`,

saveSessions (data: any) {
saveSessions(data: any) {
const config: AxiosInterface = {

@@ -137,3 +137,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/saveSessions`,

getFlowData (profileKey: string) {
getFlowData(profileKey: string) {
const config: AxiosInterface = {

@@ -140,0 +140,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NODE_RED}/getFlowData`,

@@ -20,3 +20,3 @@ import { Enums } from '../../utils/enums'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
this.outputFormat = {

@@ -34,10 +34,23 @@ JSON: Enums.VALUE_JSON_LOWER,

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_NUMBERING, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_NUMBERING,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -50,6 +63,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_NUMBERING, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_NUMBERING,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -60,6 +81,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_NUMBERING, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_NUMBERING,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -70,6 +99,19 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_NUMBERING, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_NUMBERING,
Enums.METHOD_DELETE,
null,
headers
)
}
generate (profileKey: string = Enums.STRING_EMPTY, outputFormat: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
generate(
profileKey: string = Enums.STRING_EMPTY,
outputFormat: string = Enums.STRING_EMPTY,
data: any = {},
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -92,3 +134,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NUMBERING}/${Enums.STRING_GENERATE}`,

resetCounters (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
resetCounters(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -100,3 +142,4 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_NUMBERING}/resetCounters`,

if (logProfileKey !== undefined && logProfileKey !== null) config.headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
if (logProfileKey !== undefined && logProfileKey !== null)
config.headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
if (recordId !== undefined && recordId !== null) config.headers[Enums.HEADER_RECORD_ID] = recordId

@@ -103,0 +146,0 @@ if (this.apiKey !== undefined && this.apiKey !== null) config.headers[Enums.HEADER_API_KEY] = this.apiKey

@@ -14,3 +14,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -23,10 +23,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ROLES, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ROLES,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -39,6 +52,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ROLES, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ROLES,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -49,6 +70,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ROLES, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ROLES,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -59,6 +88,19 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_ROLES, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_ROLES,
Enums.METHOD_DELETE,
null,
headers
)
}
getRole (roleNames: Array<string> = [], conditionalLevels: Array<string> = [], data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
getRole(
roleNames: Array<string> = [],
conditionalLevels: Array<string> = [],
data: any = {},
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -75,3 +117,4 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_ROLES}/getRole`,

if (roleNames) config.headers[Enums.HEADER_ROLE_NAMES] = roleNames.join(Enums.SEPARATOR_COMMA)
if (conditionalLevels) config.headers[Enums.HEADER_CONDITIONAL_LEVELS] = conditionalLevels.join(Enums.SEPARATOR_COMMA)
if (conditionalLevels)
config.headers[Enums.HEADER_CONDITIONAL_LEVELS] = conditionalLevels.join(Enums.SEPARATOR_COMMA)
if (this.apiKey) config.headers[Enums.HEADER_API_KEY] = this.apiKey

@@ -83,3 +126,7 @@ if (this.teamId) config.headers[Enums.HEADER_TEAM_NAME] = this.teamId

changeConditionalLevels (recordId: string = Enums.STRING_EMPTY, conditionalLevels: Array<string> = [], logProfileKey: string = Enums.STRING_EMPTY) {
changeConditionalLevels(
recordId: string = Enums.STRING_EMPTY,
conditionalLevels: Array<string> = [],
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -93,3 +140,4 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_ROLES}/changeConditionalLevels`,

if (recordId) config.headers[Enums.HEADER_RECORD_ID] = recordId
if (conditionalLevels) config.headers[Enums.HEADER_CONDITIONAL_LEVELS] = conditionalLevels.join(Enums.SEPARATOR_COMMA)
if (conditionalLevels)
config.headers[Enums.HEADER_CONDITIONAL_LEVELS] = conditionalLevels.join(Enums.SEPARATOR_COMMA)
if (this.apiKey) config.headers[Enums.HEADER_API_KEY] = this.apiKey

@@ -101,3 +149,7 @@ if (this.teamId) config.headers[Enums.HEADER_TEAM_NAME] = this.teamId

reAssignResponsibleUser (recordId: string = Enums.STRING_EMPTY, responsibleUser: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
reAssignResponsibleUser(
recordId: string = Enums.STRING_EMPTY,
responsibleUser: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -104,0 +156,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_ROLES}/reAssignResponsibleUser`,

@@ -13,3 +13,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
if (config) {

@@ -22,10 +22,23 @@ this.apiServerUrl = config.apiServerUrl

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TEMPLATES, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TEMPLATES,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -38,6 +51,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TEMPLATES, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TEMPLATES,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -48,6 +69,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TEMPLATES, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TEMPLATES,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -58,6 +87,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TEMPLATES, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TEMPLATES,
Enums.METHOD_DELETE,
null,
headers
)
}
execute (profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
execute(profileKey: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -64,0 +101,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_TEMPLATES}/${Enums.STRING_EXECUTE}`,

@@ -15,3 +15,3 @@ 'use strict'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
this.sort = {

@@ -37,10 +37,23 @@ ASC: 'asc',

postData (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
postData(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}
if (logProfileKey) headers[Enums.HEADER_LOG_PROFILE_KEY] = logProfileKey
return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TIER_STRUCTURES, Enums.METHOD_POST, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TIER_STRUCTURES,
Enums.METHOD_POST,
data,
headers
)
}
getData (profileKeys: Array<string> = [], recordIds: Array<string> = [], slimResult: boolean = true, logProfileKey: string = Enums.STRING_EMPTY) {
getData(
profileKeys: Array<string> = [],
recordIds: Array<string> = [],
slimResult: boolean = true,
logProfileKey: string = Enums.STRING_EMPTY
) {
let headers: any = {}

@@ -53,6 +66,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TIER_STRUCTURES, Enums.METHOD_GET, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TIER_STRUCTURES,
Enums.METHOD_GET,
null,
headers
)
}
putData (recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
putData(recordId: string = Enums.STRING_EMPTY, data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -63,6 +84,14 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TIER_STRUCTURES, Enums.METHOD_PUT, data, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TIER_STRUCTURES,
Enums.METHOD_PUT,
data,
headers
)
}
deleteData (recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
deleteData(recordId: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let headers: any = {}

@@ -73,6 +102,22 @@

return executeCRUDRequest(this.apiServerUrl, this.apiKey, this.teamId, Enums.MODULE_KEY_TIER_STRUCTURES, Enums.METHOD_DELETE, null, headers)
return executeCRUDRequest(
this.apiServerUrl,
this.apiKey,
this.teamId,
Enums.MODULE_KEY_TIER_STRUCTURES,
Enums.METHOD_DELETE,
null,
headers
)
}
getTierByKey (tierKeys: Array<string> = [], includeValues: boolean = true, includeMetaData: boolean = false, includeTierEntries: boolean = false, sortValues: string = Enums.STRING_EMPTY, valuesOutputFormat: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
getTierByKey(
tierKeys: Array<string> = [],
includeValues: boolean = true,
includeMetaData: boolean = false,
includeTierEntries: boolean = false,
sortValues: string = Enums.STRING_EMPTY,
valuesOutputFormat: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -98,2 +143,2 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_TIER_STRUCTURES}/getTierByKey`,

export default TierStructures
export default TierStructures

@@ -21,3 +21,3 @@ import { Enums } from '../../utils/enums'

constructor (config: ConfigInterface) {
constructor(config: ConfigInterface) {
this.responseType = {

@@ -39,3 +39,3 @@ ARRAY_BUFFER: 'arraybuffer',

encodeXML (data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
encodeXML(data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -56,3 +56,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/encodeXML`,

decodeXML (data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
decodeXML(data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -73,3 +73,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/decodeXML`,

XMLToJS (data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
XMLToJS(data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -90,3 +90,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/XMLToJS`,

JSToXML (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
JSToXML(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -107,3 +107,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/JSToXML`,

html2json (data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
html2json(data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -124,3 +124,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/html2json`,

jsonDiff (data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
jsonDiff(data: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -141,3 +141,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/jsonDiff`,

generateOCR (recordId: string, logProfileKey = Enums.STRING_EMPTY) {
generateOCR(recordId: string, logProfileKey = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -158,3 +158,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/generateOCR`,

generateUsername (fullName: string, data: any = [], logProfileKey: string = Enums.STRING_EMPTY) {
generateUsername(fullName: string, data: any = [], logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -176,3 +176,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/generateUsername`,

generatePDF (data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
generatePDF(data: any = {}, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -193,3 +193,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/generatePDF`,

generateUUID (logProfileKey: string = Enums.STRING_EMPTY) {
generateUUID(logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -208,3 +208,7 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/generateUUID`,

formatDateTime (dateTimeValue: string = Enums.STRING_EMPTY, formatKey: string = Enums.STRING_EMPTY, logProfileKey: string = Enums.STRING_EMPTY) {
formatDateTime(
dateTimeValue: string = Enums.STRING_EMPTY,
formatKey: string = Enums.STRING_EMPTY,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -225,3 +229,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/formatDateTime`,

account (logProfileKey: string = Enums.STRING_EMPTY) {
account(logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -240,3 +244,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_ADMIN}/account`,

dashboardReports (startDate: string, endDate: string, logProfileKey: string = Enums.STRING_EMPTY) {
dashboardReports(startDate: string, endDate: string, logProfileKey: string = Enums.STRING_EMPTY) {
let config: AxiosInterface = {

@@ -257,3 +261,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_REPORTS}/dashboard`,

homePageReports () {
homePageReports() {
let config: AxiosInterface = {

@@ -271,3 +275,9 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_REPORTS}/homePage`,

exportData (includeModules: boolean = false, solutionsArray: Array<any> = [], includeData: boolean = false, includeCredentials: boolean = false, logProfileKey: string = Enums.STRING_EMPTY) {
exportData(
includeModules: boolean = false,
solutionsArray: Array<any> = [],
includeData: boolean = false,
includeCredentials: boolean = false,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -291,3 +301,10 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/exportAllData`,

importData (fileId: string, includeModules: boolean = false, solutionsArray: Array<string> = [], includeData: boolean = false, includeCredentials: boolean = false, logProfileKey: string = Enums.STRING_EMPTY) {
importData(
fileId: string,
includeModules: boolean = false,
solutionsArray: Array<string> = [],
includeData: boolean = false,
includeCredentials: boolean = false,
logProfileKey: string = Enums.STRING_EMPTY
) {
let config: AxiosInterface = {

@@ -311,3 +328,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/importData`,

getIP () {
getIP() {
let config: AxiosInterface = {

@@ -325,3 +342,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/ip`,

getUserAgent () {
getUserAgent() {
let config: AxiosInterface = {

@@ -339,3 +356,3 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/useragent`,

returnISOLanguages () {
returnISOLanguages() {
let config: AxiosInterface = {

@@ -342,0 +359,0 @@ url: `${this.apiServerUrl}/${Enums.MODULE_KEY_UTILS}/isoLanguages`,

export interface AxiosInterface {
url: string
method: string
headers: any,
data?: any,
headers: any
data?: any
responseType?: string

@@ -10,121 +10,121 @@ }

export interface EnumsInterface {
URL_API_SERVER: string,
STRING_EMPTY: string,
STRING_DATA: string,
STRING_GENERATE: string,
STRING_RESET: string,
STRING_DISABLE: string,
STRING_ENABLE: string,
STRING_EXECUTE: string,
STRING_RESET_CONNECTION_POOL: string,
STRING_GET_BY_PROFILE_KEY: string,
STRING_CREATE_LOG_ENTRY: string,
STRING_GET_LOGS: string,
STRING_RESET_LOGS: string,
STRING_SUBSCRIBE: string,
HEADER_ISO_LANGUAGE: string,
HEADER_START_DATE: string,
HEADER_END_DATE: string,
HEADER_INCLUDE_MODULES: string,
HEADER_API_KEY: string,
HEADER_TEAM_NAME: string,
HEADER_CONTENT_TYPE: string,
HEADER_PERSIST_FILE: string,
HEADER_IS_PUBLIC: string,
HEADER_PROFILE_KEY: string,
HEADER_PROFILE_KEYS: string,
HEADER_ROUTE_KEY: string,
HEADER_PROCESS_KEY: string,
HEADER_PROCESS_KEYS: string,
HEADER_BPM_RECORD_ID: string,
HEADER_BPM_RECORD_IDS: string,
HEADER_STEP_NAMES: string,
HEADER_RECORD_ID: string,
HEADER_RECORD_IDS: string,
HEADER_ROLE_NAME: string,
HEADER_ROLE_NAMES: string,
HEADER_CONDITIONAL_LEVELS: string,
HEADER_SLIM_RESULT: string,
HEADER_PUBLISH: string,
HEADER_RESET_SERVICE: string,
HEADER_CURRENT_USER: string,
HEADER_CURRENT_STEP: string,
HEADER_OPTION_SELECTED: string,
HEADER_COMMENTS: string,
HEADER_DATE_TIME_VALUE: string,
HEADER_FORMAT_KEY: string,
HEADER_RESPONSIBLE_USER: string,
HEADER_CURRENT_RESPONSIBLE_USER: string,
HEADER_NEW_RESPONSIBLE_USER: string,
HEADER_RESPONSIBLE_USERS: string,
HEADER_RELEVANT_USERS: string,
HEADER_INCLUDE_HISTORY: string,
HEADER_INCLUDE_STEP_OPTIONS: string,
HEADER_INCLUDE_VISIBLE_OBJECTS: string,
HEADER_INCLUDE_KEYWORDS: string,
HEADER_PAGE: string,
HEADER_PAGE_LIMIT: string,
HEADER_APPLICATION_JSON: string,
HEADER_OCTET_STREAM: string,
HEADER_TEXT_PLAIN: string,
HEADER_SORT: string,
HEADER_SORT_BY: string,
HEADER_OUTPUT_FORMAT: string,
HEADER_GROUP_NAME: string,
HEADER_VALUE_KEY: string,
HEADER_LABEL_KEY: string,
HEADER_VALUE: string,
HEADER_LABEL: string,
HEADER_FILE_ID: string,
HEADER_FILE_NAME: string,
HEADER_FULL_NAME: string,
HEADER_TIER_KEYS: string,
HEADER_INCLUDE_VALUES: string,
HEADER_INCLUDE_META_DATA: string,
HEADER_INCLUDE_TIER_ENTRIES: string,
HEADER_RELEVANT_ROLES: string,
HEADER_EVENT_STAMPS: string,
HEADER_EVENT_START_DATE: string,
HEADER_EVENT_END_DATE: string,
HEADER_SORT_VALUES: string,
HEADER_VALUES_OUTPUT_FORMAT: string,
HEADER_LOG_PROFILE_KEY: string,
HEADER_CATEGORY: string,
HEADER_SUB_CATEGORY: string,
HEADER_CODE: string,
HEADER_MESSAGE: string,
HEADER_FIELDS_TO_RETURN: string,
HEADER_QRY_OPTIONS: string,
HEADER_INCLUDE_DATA: string,
HEADER_INCLUDE_CREDENTIALS: string,
METHOD_DELETE: string,
METHOD_GET: string,
METHOD_POST: string,
METHOD_PUT: string,
MODULE_KEY_API_KEYS: string,
MODULE_KEY_KEYWORDS: string,
MODULE_KEY_NUMBERING: string,
MODULE_KEY_CONNECTORS: string,
MODULE_KEY_DATA_MAPPING: string,
MODULE_KEY_TEMPLATES: string,
MODULE_KEY_BPM: string,
MODULE_KEY_ROLES: string,
MODULE_KEY_BOT_BUILDER: string,
MODULE_KEY_TIER_STRUCTURES: string,
MODULE_KEY_BATCH_ACTIONS: string,
MODULE_KEY_BATCH_LOGGING: string,
MODULE_KEY_EVENTS: string,
MODULE_KEY_FILES: string,
MODULE_KEY_UTILS: string,
MODULE_KEY_REPORTS: string,
MODULE_KEY_ADMIN: string,
MODULE_KEY_NODE_RED: string,
MODULE_KEY_ADMIN_SOLUTIONS: string,
VALUE_ARRAY_PROPER: string,
VALUE_ARRAY_LOWER: string,
VALUE_OBJECT_PROPER: string,
VALUE_STRING_LOWER: string,
VALUE_NUMBER_LOWER: string,
VALUE_BOOLEAN_LOWER: string,
VALUE_JSON_LOWER: string,
URL_API_SERVER: string
STRING_EMPTY: string
STRING_DATA: string
STRING_GENERATE: string
STRING_RESET: string
STRING_DISABLE: string
STRING_ENABLE: string
STRING_EXECUTE: string
STRING_RESET_CONNECTION_POOL: string
STRING_GET_BY_PROFILE_KEY: string
STRING_CREATE_LOG_ENTRY: string
STRING_GET_LOGS: string
STRING_RESET_LOGS: string
STRING_SUBSCRIBE: string
HEADER_ISO_LANGUAGE: string
HEADER_START_DATE: string
HEADER_END_DATE: string
HEADER_INCLUDE_MODULES: string
HEADER_API_KEY: string
HEADER_TEAM_NAME: string
HEADER_CONTENT_TYPE: string
HEADER_PERSIST_FILE: string
HEADER_IS_PUBLIC: string
HEADER_PROFILE_KEY: string
HEADER_PROFILE_KEYS: string
HEADER_ROUTE_KEY: string
HEADER_PROCESS_KEY: string
HEADER_PROCESS_KEYS: string
HEADER_BPM_RECORD_ID: string
HEADER_BPM_RECORD_IDS: string
HEADER_STEP_NAMES: string
HEADER_RECORD_ID: string
HEADER_RECORD_IDS: string
HEADER_ROLE_NAME: string
HEADER_ROLE_NAMES: string
HEADER_CONDITIONAL_LEVELS: string
HEADER_SLIM_RESULT: string
HEADER_PUBLISH: string
HEADER_RESET_SERVICE: string
HEADER_CURRENT_USER: string
HEADER_CURRENT_STEP: string
HEADER_OPTION_SELECTED: string
HEADER_COMMENTS: string
HEADER_DATE_TIME_VALUE: string
HEADER_FORMAT_KEY: string
HEADER_RESPONSIBLE_USER: string
HEADER_CURRENT_RESPONSIBLE_USER: string
HEADER_NEW_RESPONSIBLE_USER: string
HEADER_RESPONSIBLE_USERS: string
HEADER_RELEVANT_USERS: string
HEADER_INCLUDE_HISTORY: string
HEADER_INCLUDE_STEP_OPTIONS: string
HEADER_INCLUDE_VISIBLE_OBJECTS: string
HEADER_INCLUDE_KEYWORDS: string
HEADER_PAGE: string
HEADER_PAGE_LIMIT: string
HEADER_APPLICATION_JSON: string
HEADER_OCTET_STREAM: string
HEADER_TEXT_PLAIN: string
HEADER_SORT: string
HEADER_SORT_BY: string
HEADER_OUTPUT_FORMAT: string
HEADER_GROUP_NAME: string
HEADER_VALUE_KEY: string
HEADER_LABEL_KEY: string
HEADER_VALUE: string
HEADER_LABEL: string
HEADER_FILE_ID: string
HEADER_FILE_NAME: string
HEADER_FULL_NAME: string
HEADER_TIER_KEYS: string
HEADER_INCLUDE_VALUES: string
HEADER_INCLUDE_META_DATA: string
HEADER_INCLUDE_TIER_ENTRIES: string
HEADER_RELEVANT_ROLES: string
HEADER_EVENT_STAMPS: string
HEADER_EVENT_START_DATE: string
HEADER_EVENT_END_DATE: string
HEADER_SORT_VALUES: string
HEADER_VALUES_OUTPUT_FORMAT: string
HEADER_LOG_PROFILE_KEY: string
HEADER_CATEGORY: string
HEADER_SUB_CATEGORY: string
HEADER_CODE: string
HEADER_MESSAGE: string
HEADER_FIELDS_TO_RETURN: string
HEADER_QRY_OPTIONS: string
HEADER_INCLUDE_DATA: string
HEADER_INCLUDE_CREDENTIALS: string
METHOD_DELETE: string
METHOD_GET: string
METHOD_POST: string
METHOD_PUT: string
MODULE_KEY_API_KEYS: string
MODULE_KEY_KEYWORDS: string
MODULE_KEY_NUMBERING: string
MODULE_KEY_CONNECTORS: string
MODULE_KEY_DATA_MAPPING: string
MODULE_KEY_TEMPLATES: string
MODULE_KEY_BPM: string
MODULE_KEY_ROLES: string
MODULE_KEY_BOT_BUILDER: string
MODULE_KEY_TIER_STRUCTURES: string
MODULE_KEY_BATCH_ACTIONS: string
MODULE_KEY_BATCH_LOGGING: string
MODULE_KEY_EVENTS: string
MODULE_KEY_FILES: string
MODULE_KEY_UTILS: string
MODULE_KEY_REPORTS: string
MODULE_KEY_ADMIN: string
MODULE_KEY_NODE_RED: string
MODULE_KEY_ADMIN_SOLUTIONS: string
VALUE_ARRAY_PROPER: string
VALUE_ARRAY_LOWER: string
VALUE_OBJECT_PROPER: string
VALUE_STRING_LOWER: string
VALUE_NUMBER_LOWER: string
VALUE_BOOLEAN_LOWER: string
VALUE_JSON_LOWER: string
SEPARATOR_COMMA: string

@@ -134,29 +134,29 @@ }

export interface EnumsTypeDetectInterface {
ARRAY: string,
ARRAY_BUFFER: string,
ARGS: string,
BOOLEAN: string,
DATA_VIEW: string,
DATE: string,
FUNCTION: string,
FLOAT32ARRAY: string,
FLOAT64ARRAY: string,
INT8ARRAY: string,
INT16ARRAY: string,
INT32ARRAY: string,
MAP: string,
NULL: string,
NUMBER: string,
OBJECT: string,
PROMISE: string,
REGEX: string,
SET: string,
STRING: string,
SYMBOL: string,
UINT8ARRAY: string,
UINT8CLAMPEDARRAY: string,
UINT16ARRAY: string,
UINT32ARRAY: string,
UNDEFINED: string,
WEAK_MAP: string,
ARRAY: string
ARRAY_BUFFER: string
ARGS: string
BOOLEAN: string
DATA_VIEW: string
DATE: string
FUNCTION: string
FLOAT32ARRAY: string
FLOAT64ARRAY: string
INT8ARRAY: string
INT16ARRAY: string
INT32ARRAY: string
MAP: string
NULL: string
NUMBER: string
OBJECT: string
PROMISE: string
REGEX: string
SET: string
STRING: string
SYMBOL: string
UINT8ARRAY: string
UINT8CLAMPEDARRAY: string
UINT16ARRAY: string
UINT32ARRAY: string
UNDEFINED: string
WEAK_MAP: string
WEAK_SET: string

@@ -163,0 +163,0 @@ }

@@ -13,3 +13,11 @@ 'use strict'

export const executeCRUDRequest = (apiServerUrl: string = Enums.STRING_EMPTY, apiKey: string = Enums.STRING_EMPTY, teamId: string = Enums.STRING_EMPTY, appName: string = Enums.STRING_EMPTY, method: string = Enums.STRING_EMPTY, data: any = {}, headers: any = {}) => {
export const executeCRUDRequest = (
apiServerUrl: string = Enums.STRING_EMPTY,
apiKey: string = Enums.STRING_EMPTY,
teamId: string = Enums.STRING_EMPTY,
appName: string = Enums.STRING_EMPTY,
method: string = Enums.STRING_EMPTY,
data: any = {},
headers: any = {}
) => {
const config: AxiosInterface = {

@@ -16,0 +24,0 @@ url: `${apiServerUrl}/${appName}/${Enums.STRING_DATA}`,

@@ -44,4 +44,3 @@ /* eslint-env mocha */

describe('API Key', () => {
describe('Negative Tests', () => {
})
describe('Negative Tests', () => {})

@@ -48,0 +47,0 @@ describe('Positive Tests', () => {

@@ -10,2 +10,3 @@ /* eslint-env mocha */

const EnumsTypeDetect = require('agilite-utils/enums-type-detect')
const { Enums } = require('../dist/utils/enums')
const DataTemplate = require('../data-templates/numbering')

@@ -18,3 +19,3 @@

describe('Agilit-e Numbering', () => {
describe('Agilit-e Numbering \n', () => {
const groupName = UUID.v1()

@@ -25,395 +26,475 @@ let mainEntry = null

let key = UUID.v1()
let error = null
it('Create New Invalid Record - Empty Body Object', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
describe('Create New Record', () => {
describe('Negative Tests', () => {
it('Empty Body Object', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.Numbering.postData(mainEntry)
.then((response) => {})
.catch((err) => {
error = err.response.data
agilite.Numbering.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("No 'data' property found in JSON Body")
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Invalid Record - No Key', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Key', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Numbering.postData(mainEntry)
.then((response) => {})
.catch((err) => {
error = err.response.data
agilite.Numbering.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("Please provide a valid Profile 'key'")
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Invalid Record - No Name', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.dataObject))
mainEntry.data.key = key
it('No Name', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.dataObject))
mainEntry.data.key = key
agilite.Numbering.postData(mainEntry)
.then((response) => {})
.catch((err) => {
error = err.response.data
agilite.Numbering.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("Please provide a valid Profile 'name'")
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'name'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Create New Record', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
mainEntry.data.name = key
describe('Positive Tests', () => {
it('Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
mainEntry.data.name = key
agilite.Numbering.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Numbering.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if Optional Fields exists
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data).to.haveOwnProperty('prefix')
expect(response.data.data).to.haveOwnProperty('suffix')
expect(response.data.data).to.haveOwnProperty('startAt')
expect(response.data.data).to.haveOwnProperty('incrementBasedOn')
expect(response.data.data).to.haveOwnProperty('minLength')
// Check if Optional Fields exists
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data).to.haveOwnProperty('prefix')
expect(response.data.data).to.haveOwnProperty('suffix')
expect(response.data.data).to.haveOwnProperty('startAt')
expect(response.data.data).to.haveOwnProperty('incrementBasedOn')
expect(response.data.data).to.haveOwnProperty('minLength')
// Compare Values to confirm that data passed is the same as the data returned
expect(response.data.data.name).to.equal(mainEntry.data.name)
// Compare Values to confirm that data passed is the same as the data returned
expect(response.data.data.name).to.equal(mainEntry.data.name)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
})
it('Get Data - Slim Result - Find Record By Id', (done) => {
expect(recordId).to.not.equal(null)
describe('Get Data', () => {
describe('Negative Tests', () => {})
agilite.Numbering.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
describe('Positive Tests', () => {
it('Slim Result - Find Record By Id', (done) => {
expect(recordId).to.not.equal(null)
for (const x in response.data) {
tmpEntry = response.data[x]
agilite.Numbering.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
if (tmpEntry._id === recordId) {
// Check that data objects exist
expect(tmpEntry).to.haveOwnProperty('data')
for (const x in response.data) {
tmpEntry = response.data[x]
// Check if the returned object is a Slim Result
expect(tmpEntry.createdBy).to.equal(undefined)
}
}
if (tmpEntry._id === recordId) {
// Check that data objects exist
expect(tmpEntry).to.haveOwnProperty('data')
// Check if the returned object is a Slim Result
expect(tmpEntry.createdBy).to.equal(undefined)
}
}
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
})
it('Generate Number - Test 1', (done) => {
expect(key).to.not.equal(null)
describe('Generate', () => {
describe('Negative Tests', () => {})
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.equal(1)
describe('Positive Tests', () => {
it('Success', (done) => {
expect(key).to.not.equal(null)
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.equal(1)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
})
it('Update Record - No ID', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
describe('Update Record', () => {
describe('Negative Tests', () => {
it('No ID', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.Numbering.putData(undefined, mainEntry)
.then((response) => {})
.catch((err) => {
error = err.response.data
agilite.Numbering.putData(undefined, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Update Record - Empty Body Object', (done) => {
expect(recordId).to.not.equal(null)
it('Empty Body Object', (done) => {
expect(recordId).to.not.equal(null)
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.Numbering.putData(recordId, mainEntry)
.then((response) => {})
.catch((err) => {
error = err.response.data
agilite.Numbering.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("No 'data' property found in JSON Body")
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Record - No Key', (done) => {
expect(recordId).to.not.equal(null)
it('No Key', (done) => {
expect(recordId).to.not.equal(null)
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Numbering.putData(recordId, mainEntry)
.then((response) => {})
.catch((err) => {
error = err.response.data
agilite.Numbering.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("Please provide a valid Profile 'key'")
it('No Name', (done) => {
expect(recordId).to.not.equal(null)
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
})
.then(done, done)
})
mainEntry = JSON.parse(JSON.stringify(DataTemplate.dataObject))
mainEntry.data.key = key
it('Update Record - No Name', (done) => {
expect(recordId).to.not.equal(null)
agilite.Numbering.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
mainEntry = JSON.parse(JSON.stringify(DataTemplate.dataObject))
mainEntry.data.key = key
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Numbering.putData(recordId, mainEntry)
.then((response) => {})
.catch((err) => {
error = err.response.data
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'name'")
})
.then(done, done)
})
})
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
describe('Positive Tests', () => {
it('Success', (done) => {
expect(recordId).to.not.equal(null)
key = 'PUT_' + key
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.groupName = groupName
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("Please provide a valid Profile 'name'")
agilite.Numbering.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check if GroupName exists and contains passed value
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(mainEntry.data.groupName)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
.then(done, done)
})
})
it('Update Record', (done) => {
expect(recordId).to.not.equal(null)
key = 'PUT_' + key
describe('Generate 2', () => {
describe('Negative Tests', () => {})
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.groupName = groupName
describe('Positive Tests', () => {
it('Success', (done) => {
expect(key).to.not.equal(null)
agilite.Numbering.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if GroupName exists and contains passed value
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(mainEntry.data.groupName)
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('PRE00010SUF')
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
it('Generate Number - Test 2', (done) => {
expect(key).to.not.equal(null)
it('Success 2', (done) => {
expect(key).to.not.equal(null)
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('PRE00010SUF')
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('PRE00011SUF')
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
})
it('Generate Number - Test 3', (done) => {
expect(key).to.not.equal(null)
describe('Reset Numbering Counters', () => {
describe('Negative Tests', () => {})
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('PRE00011SUF')
describe('Positive Tests', () => {
it('Success', (done) => {
expect(recordId).to.not.equal(null)
agilite.Numbering.resetCounters(recordId)
.then((response) => {
expect(response).to.haveOwnProperty('data')
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
})
it.skip('Reset Numbering Counters', (done) => {
expect(recordId).to.not.equal(null)
describe('Generate 3', () => {
describe('Negative Tests', () => {})
agilite.Numbering.resetCounters(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.catch((err) => {
console.log(err.response.data)
})
.then(done, done)
})
describe('Positive Tests', () => {
it('Success', (done) => {
expect(key).to.not.equal(null)
it('Generate Number - Test 4', (done) => {
expect(key).to.not.equal(null)
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('PRE00012SUF')
agilite.Numbering.generate(key, agilite.Numbering.outputFormat.STRING, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('PRE00010SUF')
})
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
})
it('Delete Record - No Record ID', (done) => {
agilite.Numbering.deleteData()
.then((response) => {})
.catch((err) => {
error = err.response.data
describe('Delete Record', () => {
describe('Negative Tests', () => {
it('No Record ID', (done) => {
agilite.Numbering.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Delete Record - Non-existant Record ID', (done) => {
agilite.Numbering.deleteData('test')
.then((response) => {})
.catch((err) => {
error = err.response.data
it('Non-existant Record ID', (done) => {
agilite.Numbering.deleteData('test')
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(TypeDetect(error)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if statusCode exists and contains correct value
expect(error).to.haveOwnProperty('statusCode')
expect(error.statusCode).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(error).to.haveOwnProperty('errorMessage')
expect(error.errorMessage).to.equal(`Cast to ObjectId failed for value "test" at path "_id" for model "${process.env.TEAM_NAME}_numbering"`)
// Check if additionalMessages exists and is blank array
expect(error).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(error.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
// IF WE DON'T INCLUDE STACK
// expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
// expect(err.response.data.errorMessage).to.equal(`Cast to ObjectId failed for value "test" at path "_id" for model "${process.env.TEAM_NAME}_numbering"`)
// IF WE INCLUDE STACK
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response.data.errorMessage).to.haveOwnProperty('message')
expect(TypeDetect(err.response.data.errorMessage.message)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage.message).to.equal(
`Cast to ObjectId failed for value "test" at path "_id" for model "${process.env.TEAM_NAME}_numbering"`
)
expect(err.response.data.errorMessage).to.haveOwnProperty('stack')
expect(TypeDetect(err.response.data.errorMessage.stack)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage.stack).to.not.equal(Enums.STRING_EMPTY)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record', (done) => {
expect(recordId).to.not.equal(null)
describe('Positive Tests', () => {
it('Success', (done) => {
expect(recordId).to.not.equal(null)
agilite.Numbering.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
agilite.Numbering.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
// .catch((err) => {
// console.log(err.response.data)
// })
.then(done, done)
})
})
})

@@ -18,3 +18,3 @@ /* eslint-env mocha */

describe('Agilit-e Connectors', () => {
describe('Agilit-e Connectors \n', () => {
const invalidValue = 'invalid_value'

@@ -27,326 +27,497 @@

it('Create New Record - No Params (Negative)', (done) => {
agilite.Connectors.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Create New Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Connectors.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
it('Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.Connectors.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Connectors.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Connectors.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Connectors.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Name (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
it('No Profile Name (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
agilite.Connectors.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Connectors.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'name\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'name'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Create New Record - Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
mainEntry.data.name = key
describe('Positive Tests', () => {
it('Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
mainEntry.data.name = key
agilite.Connectors.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Connectors.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data.name).to.equal(key)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data.name).to.equal(key)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('connectionType')
expect(response.data.data.connectionType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('routes')
expect(TypeDetect(response.data.data.routes)).to.equal(EnumsTypeDetect.ARRAY)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('connectionType')
expect(response.data.data.connectionType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('routes')
expect(TypeDetect(response.data.data.routes)).to.equal(EnumsTypeDetect.ARRAY)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Data - Slim Result - Find Record By Id - Success', (done) => {
agilite.Connectors.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
describe('Get Data', () => {
describe('Negative Tests', () => {})
for (const x in response.data) {
tmpEntry = response.data[x]
describe('Positive Tests', () => {
it('Slim Result - Find Record By Id - Success', (done) => {
agilite.Connectors.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
for (const x in response.data) {
tmpEntry = response.data[x]
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - No Params (Negative)', (done) => {
agilite.Connectors.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Update Existing Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Connectors.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Data Param (Negative)', (done) => {
agilite.Connectors.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('No Data Param (Negative)', (done) => {
agilite.Connectors.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Empty Object Data Param (Negative)', (done) => {
agilite.Connectors.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Empty Object Data Param (Negative)', (done) => {
agilite.Connectors.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Connectors.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Connectors.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
mainEntry.data.name = key
describe('Positive Tests', () => {
it('Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
mainEntry.data.name = key
agilite.Connectors.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Connectors.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('name')
expect(response.data.data.name).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('name')
expect(response.data.data.name).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('connectionType')
expect(response.data.data.connectionType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('routes')
expect(TypeDetect(response.data.data.routes)).to.equal(EnumsTypeDetect.ARRAY)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('connectionType')
expect(response.data.data.connectionType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('routes')
expect(TypeDetect(response.data.data.routes)).to.equal(EnumsTypeDetect.ARRAY)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Execute - No Params (Negative)', (done) => {
agilite.Connectors.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Execute', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Connectors.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Profile Key was specified in the \'profile-key\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"No Profile Key was specified in the 'profile-key' header parameter"
)
})
.then(done, done)
})
.then(done, done)
})
it('Execute - No Route Key (Negative)', (done) => {
agilite.Connectors.execute(key)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('No Route Key (Negative)', (done) => {
agilite.Connectors.execute(key)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Route Key was specified in the \'route-key\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"No Route Key was specified in the 'route-key' header parameter"
)
})
.then(done, done)
})
.then(done, done)
})
})
it('Execute - Success', (done) => {
agilite.Connectors.execute(key, 'ping')
.then((response) => {
expect(response).to.haveOwnProperty('data')
expect(response.data).to.equal('pong')
describe('Positive Tests', () => {
it.skip('Success', (done) => {
agilite.Connectors.execute(key, 'ping')
.then((response) => {
console.log(response)
expect(response).to.haveOwnProperty('data')
expect(response.data).to.equal('pong')
})
.catch((err) => {
console.log(err)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - No Record Id (Negative)', (done) => {
agilite.Connectors.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Delete Record', () => {
describe('Negative Tests', () => {
it('No Record Id (Negative)', (done) => {
agilite.Connectors.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Delete Record - Invalid Record Id (Negative)', (done) => {
agilite.Connectors.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Record Id (Negative)', (done) => {
agilite.Connectors.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - Success', (done) => {
agilite.Connectors.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
describe('Positive Tests', () => {
it('Success', (done) => {
agilite.Connectors.deleteData(recordId)
.then((response) => {
expect(response).to.haveOwnProperty('data')
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.then(done, done)
})
.then(done, done)
})
})
})

@@ -18,3 +18,3 @@ /* eslint-env mocha */

describe('Agilit-e Data Mapping', () => {
describe('Agilit-e Data Mapping \n', () => {
const invalidValue = 'invalid_value'

@@ -27,511 +27,758 @@

it('Create New Record - No Params (Negative)', (done) => {
agilite.DataMappings.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Create New Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.DataMappings.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
it('Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Name (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
it('No Profile Name (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'name\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'name'")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
it('No Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'sourceType\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid 'sourceType'")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Destination Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
it('No Destination Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'destinationType\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid 'destinationType'")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Invalid Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '3'
mainEntry.data.destinationType = '2'
it('Invalid Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '3'
mainEntry.data.destinationType = '2'
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'sourceType\' value e.g \'1\' - JSON')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid 'sourceType' value e.g '1' - JSON")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Invalid Destnation Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '2'
mainEntry.data.destinationType = '3'
it('Invalid Destnation Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '2'
mainEntry.data.destinationType = '3'
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'destinationType\' value e.g \'1\' - JSON')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"Please provide a valid 'destinationType' value e.g '1' - JSON"
)
})
.then(done, done)
})
.then(done, done)
})
})
it('Create New Record - Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
mainEntry.data.destinationType = '1'
describe('Positive Tests', () => {
it('Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
mainEntry.data.destinationType = '1'
agilite.DataMappings.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('name')
expect(response.data.data.name).to.equal(key)
expect(response.data.data).to.haveOwnProperty('sourceType')
expect(response.data.data.sourceType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('destinationType')
expect(response.data.data.destinationType).to.equal('1')
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('name')
expect(response.data.data.name).to.equal(key)
expect(response.data.data).to.haveOwnProperty('sourceType')
expect(response.data.data.sourceType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('destinationType')
expect(response.data.data.destinationType).to.equal('1')
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Data - Slim Result - Find Record By Id - Success', (done) => {
agilite.DataMappings.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
describe('Get Data', () => {
describe('Negative Tests', () => {})
for (const x in response.data) {
tmpEntry = response.data[x]
describe('Positive Tests', () => {
it('Slim Result - Find Record By Id - Success', (done) => {
agilite.DataMappings.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
for (const x in response.data) {
tmpEntry = response.data[x]
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - No Params (Negative)', (done) => {
agilite.DataMappings.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Update Existing Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.DataMappings.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
it('Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Profile Name (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
it('No Profile Name (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'name\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'name'")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
it('No Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'sourceType\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid 'sourceType'")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Destination Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
it('No Destination Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'destinationType\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid 'destinationType'")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Invalid Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '3'
mainEntry.data.destinationType = '2'
it('Invalid Source Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '3'
mainEntry.data.destinationType = '2'
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'sourceType\' value e.g \'1\' - JSON')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid 'sourceType' value e.g '1' - JSON")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Invalid Destnation Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '2'
mainEntry.data.destinationType = '3'
it('Invalid Destnation Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '2'
mainEntry.data.destinationType = '3'
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid \'destinationType\' value e.g \'1\' - JSON')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"Please provide a valid 'destinationType' value e.g '1' - JSON"
)
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - Success', (done) => { // TODO: This will need fileIds for Excel
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
mainEntry.data.destinationType = '1'
describe('Positive Tests', () => {
it('Success', (done) => {
// TODO: This will need fileIds for Excel
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
mainEntry.data.name = key
mainEntry.data.sourceType = '1'
mainEntry.data.destinationType = '1'
agilite.DataMappings.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.DataMappings.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('name')
expect(response.data.data.name).to.equal(key)
expect(response.data.data).to.haveOwnProperty('sourceType')
expect(response.data.data.sourceType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('destinationType')
expect(response.data.data.destinationType).to.equal('1')
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('name')
expect(response.data.data.name).to.equal(key)
expect(response.data.data).to.haveOwnProperty('sourceType')
expect(response.data.data.sourceType).to.equal('1')
expect(response.data.data).to.haveOwnProperty('destinationType')
expect(response.data.data.destinationType).to.equal('1')
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
})
.then(done, done)
})
.then(done, done)
})
})
it('Execute - No Params (Negative)', (done) => {
agilite.DataMappings.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Execute', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.DataMappings.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Profile Key was specified in the \'profile-key\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"No Profile Key was specified in the 'profile-key' header parameter"
)
})
.then(done, done)
})
.then(done, done)
})
it('Execute - No Data (Negative)', (done) => {
agilite.DataMappings.execute(key, null)
.then((response) => {
expect(TypeDetect(response)).to.equal(EnumsTypeDetect.OBJECT)
expect(response).to.haveOwnProperty('status')
expect(TypeDetect(response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.status).to.equal(200)
expect(response).to.haveOwnProperty('data')
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('No Data (Negative)', (done) => {
agilite.DataMappings.execute(key, null)
.then((response) => {
expect(TypeDetect(response)).to.equal(EnumsTypeDetect.OBJECT)
expect(response).to.haveOwnProperty('status')
expect(TypeDetect(response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.status).to.equal(200)
expect(response).to.haveOwnProperty('data')
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('desParam1')
expect(TypeDetect(response.data.desParam1)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam1).to.equal('')
expect(response.data).to.haveOwnProperty('desParam2')
expect(TypeDetect(response.data.desParam2)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam2).to.equal('')
expect(response.data).to.haveOwnProperty('desParam1')
expect(TypeDetect(response.data.desParam1)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam1).to.equal('')
expect(response.data).to.haveOwnProperty('desParam2')
expect(TypeDetect(response.data.desParam2)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam2).to.equal('')
})
.then(done, done)
})
.then(done, done)
})
})
it.skip('Execute - Success', (done) => { // TODO: Add response validation
agilite.DataMappings.execute(key, {})
.then((response) => {
expect(TypeDetect(response)).to.equal(EnumsTypeDetect.OBJECT)
expect(response).to.haveOwnProperty('status')
expect(TypeDetect(response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.status).to.equal(200)
expect(response).to.haveOwnProperty('data')
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Positive Tests', () => {
it('Success', (done) => {
// TODO: Add response validation
agilite.DataMappings.execute(key, {})
.then((response) => {
expect(TypeDetect(response)).to.equal(EnumsTypeDetect.OBJECT)
expect(response).to.haveOwnProperty('status')
expect(TypeDetect(response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.status).to.equal(200)
expect(response).to.haveOwnProperty('data')
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('desParam1')
expect(TypeDetect(response.data.desParam1)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam1).to.equal('')
expect(response.data).to.haveOwnProperty('desParam2')
expect(TypeDetect(response.data.desParam2)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam2).to.equal('')
expect(response.data).to.haveOwnProperty('desParam1')
expect(TypeDetect(response.data.desParam1)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam1).to.equal('')
expect(response.data).to.haveOwnProperty('desParam2')
expect(TypeDetect(response.data.desParam2)).to.equal(EnumsTypeDetect.STRING)
expect(response.data.desParam2).to.equal('')
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - No Record Id (Negative)', (done) => {
agilite.DataMappings.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Delete Record', () => {
describe('Negative Tests', () => {
it('No Record Id (Negative)', (done) => {
agilite.DataMappings.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Delete Record - Invalid Record Id (Negative)', (done) => {
agilite.DataMappings.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Record Id (Negative)', (done) => {
agilite.DataMappings.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - Success', (done) => {
agilite.DataMappings.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
describe('Positive Tests', () => {
it('Success', (done) => {
agilite.DataMappings.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.then(done, done)
})
.then(done, done)
})
})
})

@@ -18,3 +18,3 @@ /* eslint-env mocha */

describe('Agilit-e Templates', () => {
describe('Agilit-e Templates \n', () => {
const invalidValue = 'invalid_value'

@@ -27,326 +27,479 @@

it('Create New Record - No Params (Negative)', (done) => {
agilite.Templates.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Create New Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Templates.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
it('Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.Templates.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Templates.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Templates.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Templates.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Create New Record - Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
describe('Positive Tests', () => {
it('Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
agilite.Templates.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Templates.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('data')
expect(response.data.data.data).to.equal('Response')
expect(response.data.data).to.haveOwnProperty('mode')
expect(response.data.data.mode).to.equal('plain_text')
expect(response.data.data).to.haveOwnProperty('theme')
expect(response.data.data.theme).to.equal('monokai')
expect(response.data.data).to.haveOwnProperty('templateType')
expect(response.data.data.templateType).to.equal('std')
expect(response.data.data).to.haveOwnProperty('editorType')
expect(response.data.data.editorType).to.equal('design')
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('data')
expect(response.data.data.data).to.equal('Response')
expect(response.data.data).to.haveOwnProperty('mode')
expect(response.data.data.mode).to.equal('plain_text')
expect(response.data.data).to.haveOwnProperty('theme')
expect(response.data.data.theme).to.equal('monokai')
expect(response.data.data).to.haveOwnProperty('templateType')
expect(response.data.data.templateType).to.equal('std')
expect(response.data.data).to.haveOwnProperty('editorType')
expect(response.data.data.editorType).to.equal('design')
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Data - Slim Result - Find Record By Id - Success', (done) => {
agilite.Templates.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
describe('Get Data', () => {
describe('Negative Tests', () => {})
for (const x in response.data) {
tmpEntry = response.data[x]
describe('Positive Tests', () => {
it('Slim Result - Find Record By Id - Success', (done) => {
agilite.Templates.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
for (const x in response.data) {
tmpEntry = response.data[x]
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - No Params (Negative)', (done) => {
agilite.Templates.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Update Existing Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Templates.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Data Param (Negative)', (done) => {
agilite.Templates.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('No Data Param (Negative)', (done) => {
agilite.Templates.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Empty Object Data Param (Negative)', (done) => {
agilite.Templates.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Empty Object Data Param (Negative)', (done) => {
agilite.Templates.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Templates.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Templates.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
describe('Positive Tests', () => {
it('Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
agilite.Templates.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Templates.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(DataTemplate.modified.data.description)
expect(response.data.data).to.haveOwnProperty('data')
expect(response.data.data.data).to.equal(DataTemplate.modified.data.data)
expect(response.data.data).to.haveOwnProperty('mode')
expect(response.data.data.mode).to.equal(DataTemplate.modified.data.mode)
expect(response.data.data).to.haveOwnProperty('theme')
expect(response.data.data.theme).to.equal(DataTemplate.modified.data.theme)
expect(response.data.data).to.haveOwnProperty('templateType')
expect(response.data.data.templateType).to.equal(DataTemplate.modified.data.templateType)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(DataTemplate.modified.data.description)
expect(response.data.data).to.haveOwnProperty('data')
expect(response.data.data.data).to.equal(DataTemplate.modified.data.data)
expect(response.data.data).to.haveOwnProperty('mode')
expect(response.data.data.mode).to.equal(DataTemplate.modified.data.mode)
expect(response.data.data).to.haveOwnProperty('theme')
expect(response.data.data.theme).to.equal(DataTemplate.modified.data.theme)
expect(response.data.data).to.haveOwnProperty('templateType')
expect(response.data.data.templateType).to.equal(DataTemplate.modified.data.templateType)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Execute Template - No Params (Negative)', (done) => {
agilite.Templates.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Execute', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Templates.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Profile Key was specified in the \'profile-key\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"No Profile Key was specified in the 'profile-key' header parameter"
)
})
.then(done, done)
})
.then(done, done)
})
it('Execute Template - Invalid Key (Negative)', (done) => {
agilite.Templates.execute('invalid')
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Key (Negative)', (done) => {
agilite.Templates.execute('invalid')
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Active Template Profile cannot be found - invalid')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal('Active Template Profile cannot be found - invalid')
})
.then(done, done)
})
.then(done, done)
})
})
it('Execute Template - Null as Data - Success', (done) => {
agilite.Templates.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('Response')
describe('Positive Tests', () => {
it('Null as Data - Success', (done) => {
agilite.Templates.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('Response')
})
.then(done, done)
})
.then(done, done)
})
it('Execute Template - Object as Data - Success', (done) => {
agilite.Templates.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('Response')
it('Object as Data - Success', (done) => {
agilite.Templates.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('Response')
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - No Record Id (Negative)', (done) => {
agilite.Templates.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Delete Record', () => {
describe('Negative Tests', () => {
it('No Record Id (Negative)', (done) => {
agilite.Templates.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Delete Record - Invalid Record Id (Negative)', (done) => {
agilite.Templates.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Record Id (Negative)', (done) => {
agilite.Templates.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - Success', (done) => {
agilite.Templates.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
describe('Positive Tests', () => {
it('Success', (done) => {
agilite.Templates.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.then(done, done)
})
.then(done, done)
})
})
})

@@ -19,8 +19,11 @@ /* eslint-env mocha */

describe('Agilit-e BPM', async () => { // eslint-disable-line
describe('Agilit-e BPM', async () => {
// eslint-disable-line
const unitTests = await MochaAgiliteCon.init('bpm', true, BPMModel)
for (const test of unitTests) MochaAgiliteCon.execute(test, agilite)
describe(' CUSTOM: Unit Tests', async () => { // eslint-disable-line
it(' -- No Name Prop (Negative)', (done) => { // eslint-disable-line
describe(' CUSTOM: Unit Tests', async () => {
// eslint-disable-line
it(' -- No Name Prop (Negative)', (done) => {
// eslint-disable-line
agilite.BPM.postData(DataTemplates[0])

@@ -35,3 +38,3 @@ .catch((err) => {

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Invalid request body. \'key\' property required')
expect(err.response.data.errorMessage).to.equal("Invalid request body. 'key' property required")
})

@@ -38,0 +41,0 @@ .then(done, done)

@@ -33,9 +33,20 @@ /* eslint-env mocha */

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Invalid request body. \'name\' property required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Invalid request body. 'name' property required")
})

@@ -51,9 +62,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Invalid request body. \'name\' property required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Invalid request body. 'name' property required")
})

@@ -69,9 +91,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Invalid request body. \'name\' property required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Invalid request body. 'name' property required")
})

@@ -120,4 +153,3 @@ .then(done, done)

describe('Get Data', () => {
describe('Negative Tests', () => {
})
describe('Negative Tests', () => {})

@@ -165,9 +197,20 @@ describe('Positive Test', () => {

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Validation Failed. \'record-id\' Header parameter required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Validation Failed. 'record-id' Header parameter required")
})

@@ -181,9 +224,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Invalid request body. \'name\' property required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Invalid request body. 'name' property required")
})

@@ -197,9 +251,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Invalid request body. \'name\' property required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Invalid request body. 'name' property required")
})

@@ -215,9 +280,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Invalid request body. \'name\' property required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Invalid request body. 'name' property required")
})

@@ -282,9 +358,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Validation Failed. \'role-names\' Header parameter required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Validation Failed. 'role-names' Header parameter required")
})

@@ -316,9 +403,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Validation Failed. \'record-id\' Header parameter required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Validation Failed. 'record-id' Header parameter required")
})

@@ -354,9 +452,20 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Validation Failed. \'record-id\' Header parameter required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Validation Failed. 'record-id' Header parameter required")
})

@@ -370,11 +479,24 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Validation Failed. \'responsible-user\' Header parameter required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"Validation Failed. 'responsible-user' Header parameter required"
)
})
.then(res => {})
.then((res) => {})
.then(done, done)

@@ -401,9 +523,20 @@ })

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Validation Failed. \'record-id\' Header parameter required')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Validation Failed. 'record-id' Header parameter required")
})

@@ -417,8 +550,19 @@ .then(done, done)

expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)

@@ -425,0 +569,0 @@ })

@@ -18,3 +18,3 @@ /* eslint-env mocha */

describe('Agilit-e Tier Structures', () => {
describe('Agilit-e Tier Structures \n', () => {
const invalidValue = 'invalid_value'

@@ -27,407 +27,593 @@

it('Create New Record - No Params (Negative)', (done) => {
agilite.TierStructures.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Create New Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.TierStructures.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
it('Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.TierStructures.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.TierStructures.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Invalid Values Data Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.values = invalidValue
it('Invalid Values Data Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.values = invalidValue
agilite.TierStructures.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Array property \'values\' not properly defined')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Array property 'values' not properly defined")
})
.then(done, done)
})
.then(done, done)
})
})
it('Create New Record - Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
describe('Positive Tests', () => {
it('Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
agilite.TierStructures.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(JSON.stringify(response.data.data.values)).to.equal(JSON.stringify(mainEntry.data.values))
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(JSON.stringify(response.data.data.values)).to.equal(JSON.stringify(mainEntry.data.values))
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('notes')
expect(response.data.data.notes).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('tierEntries')
expect(TypeDetect(response.data.data.tierEntries)).to.equal(Enums.VALUE_ARRAY_PROPER)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('notes')
expect(response.data.data.notes).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('tierEntries')
expect(TypeDetect(response.data.data.tierEntries)).to.equal(Enums.VALUE_ARRAY_PROPER)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Data - Slim Result - Find Record By Id - Success', (done) => {
agilite.TierStructures.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
describe('Get Data', () => {
describe('Negative Tests', () => {})
for (const x in response.data) {
tmpEntry = response.data[x]
describe('Positive Tests', () => {
it('Slim Result - Find Record By Id - Success', (done) => {
agilite.TierStructures.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
for (const x in response.data) {
tmpEntry = response.data[x]
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('values')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('description')
expect(TypeDetect(tmpEntry.data.description)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry.data).to.haveOwnProperty('notes')
expect(TypeDetect(tmpEntry.data.notes)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry.data).to.haveOwnProperty('tierEntries')
expect(TypeDetect(tmpEntry.data.tierEntries)).to.equal(Enums.VALUE_ARRAY_PROPER)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('values')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('description')
expect(TypeDetect(tmpEntry.data.description)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry.data).to.haveOwnProperty('notes')
expect(TypeDetect(tmpEntry.data.notes)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry.data).to.haveOwnProperty('tierEntries')
expect(TypeDetect(tmpEntry.data.tierEntries)).to.equal(Enums.VALUE_ARRAY_PROPER)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - No Params (Negative)', (done) => {
agilite.TierStructures.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Update Existing Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.TierStructures.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Data Param (Negative)', (done) => {
agilite.TierStructures.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('No Data Param (Negative)', (done) => {
agilite.TierStructures.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Empty Object Data Param (Negative)', (done) => {
agilite.TierStructures.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Empty Object Data Param (Negative)', (done) => {
agilite.TierStructures.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.TierStructures.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Invalid Values Data Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.values = invalidValue
it('Invalid Values Data Type (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
mainEntry.data.key = key
mainEntry.data.values = invalidValue
agilite.TierStructures.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Array property \'values\' not properly defined')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Array property 'values' not properly defined")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Invalid Record ID (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
it('Invalid Record ID (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
agilite.TierStructures.putData(invalidValue, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.putData(invalidValue, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
describe('Positive Tests', () => {
it('Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
agilite.TierStructures.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.TierStructures.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(JSON.stringify(response.data.data.values)).to.equal(JSON.stringify(mainEntry.data.values))
expect(response.data.data.description).to.equal(mainEntry.data.description)
expect(response.data.data.notes).to.equal(mainEntry.data.notes)
expect(TypeDetect(response.data.data.tierEntries)).to.equal(Enums.VALUE_ARRAY_PROPER)
expect(response.data.data.tierEntries.length).to.equal(1)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(JSON.stringify(response.data.data.values)).to.equal(JSON.stringify(mainEntry.data.values))
expect(response.data.data.description).to.equal(mainEntry.data.description)
expect(response.data.data.notes).to.equal(mainEntry.data.notes)
expect(TypeDetect(response.data.data.tierEntries)).to.equal(Enums.VALUE_ARRAY_PROPER)
expect(response.data.data.tierEntries.length).to.equal(1)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Tier By Key - No Tier Keys (Negative)', (done) => {
agilite.TierStructures.getTierByKey()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Get Tier By Key', () => {
describe('Negative Tests', () => {
it('No Tier Keys (Negative)', (done) => {
agilite.TierStructures.getTierByKey()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Tier Keys were specified in the \'tier-keys\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"No Tier Keys were specified in the 'tier-keys' header parameter"
)
})
.then(done, done)
})
.then(done, done)
})
it('Get Tier By Key - Invalid Tier Key (Negative)', (done) => {
agilite.TierStructures.getTierByKey([invalidValue])
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Tier Key (Negative)', (done) => {
agilite.TierStructures.getTierByKey([invalidValue])
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Active Tier Structure cannot be found - ${invalidValue}`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Active Tier Structure cannot be found - ${invalidValue}`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Tier By Key - Success', (done) => {
agilite.TierStructures.getTierByKey([key])
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(JSON.stringify(response.data)).to.equal(JSON.stringify(mainEntry.data.values))
describe('Positive Tests', () => {
it('Success', (done) => {
agilite.TierStructures.getTierByKey([key])
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(JSON.stringify(response.data)).to.equal(JSON.stringify(mainEntry.data.values))
})
.then(done, done)
})
.then(done, done)
})
it('Get Tier By Key - Include Meta Data & Tier Entries - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, true, true)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('key')
expect(response.data).to.haveOwnProperty('description')
expect(response.data).to.haveOwnProperty('notes')
expect(response.data).to.haveOwnProperty('values')
expect(response.data).to.haveOwnProperty('isActive')
it('Include Meta Data & Tier Entries - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, true, true)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('key')
expect(response.data).to.haveOwnProperty('description')
expect(response.data).to.haveOwnProperty('notes')
expect(response.data).to.haveOwnProperty('values')
expect(response.data).to.haveOwnProperty('isActive')
expect(response.data.key).to.equal(mainEntry.data.key)
expect(response.data.description).to.equal(mainEntry.data.description)
expect(response.data.notes).to.equal(mainEntry.data.notes)
expect(response.data.key).to.equal(mainEntry.data.key)
expect(response.data.description).to.equal(mainEntry.data.description)
expect(response.data.notes).to.equal(mainEntry.data.notes)
})
.then(done, done)
})
.then(done, done)
})
it('Get Tier By Key - Invalid Sort - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, false, false, invalidValue)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(JSON.stringify(response.data)).to.equal(JSON.stringify(mainEntry.data.values))
it('Invalid Sort - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, false, false, invalidValue)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(JSON.stringify(response.data)).to.equal(JSON.stringify(mainEntry.data.values))
})
.then(done, done)
})
.then(done, done)
})
it('Get Tier By Key - Invalid Sort - Invalid Output Format - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, false, false, invalidValue, invalidValue)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(JSON.stringify(response.data)).to.equal(JSON.stringify(mainEntry.data.values))
it('Invalid Sort - Invalid Output Format - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, false, false, invalidValue, invalidValue)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(JSON.stringify(response.data)).to.equal(JSON.stringify(mainEntry.data.values))
})
.then(done, done)
})
.then(done, done)
})
it('Get Tier By Key - JSON Output Format - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, false, false, '', 'json')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('JSON Output Format - Success', (done) => {
agilite.TierStructures.getTierByKey([key], true, false, false, '', 'json')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - No Record Id (Negative)', (done) => {
agilite.TierStructures.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Delete Record', () => {
describe('Negative Tests', () => {
it('No Record Id (Negative)', (done) => {
agilite.TierStructures.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Delete Record - Invalid Record Id (Negative)', (done) => {
agilite.TierStructures.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Record Id (Negative)', (done) => {
agilite.TierStructures.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - Success', (done) => {
agilite.TierStructures.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
describe('Positive Tests', () => {
it('Delete Record - Success', (done) => {
agilite.TierStructures.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.then(done, done)
})
.then(done, done)
})
})
})

@@ -15,151 +15,297 @@ /* eslint-env mocha */

describe('Agilit-e Utils', () => {
describe('Agilit-e Utils \n', () => {
let data = null
it('XML To JS', () => {
agilite.Utils.XMLToJS('<xml>Some Data</xml>')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('elements')
expect(TypeDetect(response.data.elements)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.elements.length).to.equal(1)
describe('XML to JS', () => {
describe('Negative Tests', () => {
it('Invalid Params', () => {
agilite.Utils.XMLToJS(null).catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
data = response.data
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. string Required')
})
})
})
})
it('XML To JS - Invalid Params', () => {
agilite.Utils.XMLToJS(null)
.catch((err) => {
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. string Required')
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.XMLToJS('<xml>Some Data</xml>').then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('elements')
expect(TypeDetect(response.data.elements)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.elements.length).to.equal(1)
data = response.data
})
})
})
})
it('JS To XML', () => {
agilite.Utils.JSToXML(data)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
describe('JS to XML', () => {
describe('Negative Tests', () => {
it('Invalid Params', () => {
agilite.Utils.JSToXML(null).catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
data = response.data
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. object Required')
})
})
})
})
it('JS To XML - Invalid Params', () => {
agilite.Utils.JSToXML(null)
.catch((err) => {
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. object Required')
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.JSToXML(data).then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
data = response.data
})
})
})
})
it('Encode XML', () => {
agilite.Utils.encodeXML('<XML>Hello World</XML>')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
describe('Encode XML', () => {
describe('Negative Tests', () => {
it('Invalid Params', () => {
agilite.Utils.encodeXML(null).catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
data = response.data
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. string Required')
})
})
})
})
it('Encode XML - Invalid Params', () => {
agilite.Utils.encodeXML(null)
.catch((err) => {
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. string Required')
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.encodeXML('<XML>Hello World</XML>').then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
data = response.data
})
})
})
})
it('Decode XML', () => {
agilite.Utils.decodeXML('&lt;XML&gt;Hello World&lt;/XML&gt;')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
describe('Decode XML', () => {
describe('Negative Tests', () => {
it('Invalid Params', () => {
agilite.Utils.decodeXML(null).catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. string Required')
})
})
})
})
it('Decode XML - Invalid Params', () => {
agilite.Utils.decodeXML(null)
.catch((err) => {
expect(err.response.data.errorMessage).to.equal('Incorrect Object Type: null. string Required')
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.decodeXML('&lt;XML&gt;Hello World&lt;/XML&gt;').then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
})
})
})
})
it('Format Date Time', () => {
agilite.Utils.formatDateTime('1 January 2000', 'YYYY/MM/DD')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('2000/01/01')
describe('Format Date Time', () => {
describe('Negative Tests', () => {
it('No Value and Format Params', () => {
agilite.Utils.formatDateTime().catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"No Date/Time value was specified in the 'date-time-value' header parameter"
)
})
})
})
})
it('Format Date Time - No Value and Format Params', () => {
agilite.Utils.formatDateTime()
.catch((err) => {
expect(err.response.data.errorMessage).to.equal("No Date/Time value was specified in the 'date-time-value' header parameter")
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.formatDateTime('1 January 2000', 'YYYY/MM/DD').then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('2000/01/01')
})
})
})
})
it('Generate UUID', () => {
agilite.Utils.generateUUID()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
describe('Generate UUID', () => {
describe('Negative Tests', () => {})
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.generateUUID().then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
})
})
})
})
it('HTML To JSON', () => {
agilite.Utils.html2json('<html><head></head><body>HTML Body</body></html>')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('HTML to JSON', () => {
describe('Negative Tests', () => {})
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.html2json('<html><head></head><body>HTML Body</body></html>').then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
})
})
})
})
it('Generate PDF', () => {
agilite.Utils.generatePDF()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('_id')
expect(response.data).to.haveOwnProperty('filename')
expect(response.data).to.haveOwnProperty('contentType')
expect(response.data.metadata).to.haveOwnProperty('persistFile')
expect(response.data.metadata).to.haveOwnProperty('isPublic')
expect(response.data.metadata).to.haveOwnProperty('createdBy')
expect(response.data.metadata).to.haveOwnProperty('modifiedBy')
describe('Generate PDF', () => {
describe('Negative Tests', () => {})
describe('Positive Tests', () => {
it('Success', () => {
agilite.Utils.generatePDF().then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(response.data).to.haveOwnProperty('_id')
expect(response.data).to.haveOwnProperty('filename')
expect(response.data).to.haveOwnProperty('contentType')
expect(response.data.metadata).to.haveOwnProperty('persistFile')
expect(response.data.metadata).to.haveOwnProperty('isPublic')
expect(response.data.metadata).to.haveOwnProperty('createdBy')
expect(response.data.metadata).to.haveOwnProperty('modifiedBy')
})
})
})
})
it('Generate Username - No Username List', () => {
agilite.Utils.generateUsername('John Doe')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jdoe')
describe('Generate Username', () => {
describe('Negative Tests', () => {
it('Invalid', () => {
agilite.Utils.generateUsername().catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a 'full-name' in the Header Parameter")
})
})
})
})
it('Generate Username - Username List', () => {
agilite.Utils.generateUsername('John Doe', ['jdoe', 'jdoe1'])
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jdoe2')
describe('Positive Tests', () => {
it('No Username List', () => {
agilite.Utils.generateUsername('John Doe').then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jdoe')
})
})
})
it('Generate Username - Name with middle name', () => {
agilite.Utils.generateUsername('John Mike Doe')
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jdoe')
it('Username List', () => {
agilite.Utils.generateUsername('John Doe', ['jdoe', 'jdoe1']).then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jdoe2')
})
})
})
it('Generate Username - Full Name including middle name and User List', () => {
agilite.Utils.generateUsername('John Mike Doe', ['jdoe'])
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jmdoe')
it('Name with middle name', () => {
agilite.Utils.generateUsername('John Mike Doe').then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jdoe')
})
})
})
it('Generate Username - Invalid', () => {
agilite.Utils.generateUsername()
.catch((err) => {
expect(err.response.data.errorMessage).to.equal('Please provide a \'full-name\' in the Header Parameter')
it('Full Name including middle name and User List', () => {
agilite.Utils.generateUsername('John Mike Doe', ['jdoe']).then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.STRING)
expect(response.data).to.equal('jmdoe')
})
})
})
})
})

@@ -18,3 +18,3 @@ /* eslint-env mocha */

describe('Agilit-e Batch Actions', () => {
describe('Agilit-e Batch Actions \n', () => {
const invalidValue = 'invalid_value'

@@ -27,314 +27,468 @@

it('Create New Record - No Params (Negative)', (done) => {
agilite.BatchActions.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Create New Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.BatchActions.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
it('Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.BatchActions.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.BatchActions.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.BatchActions.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.BatchActions.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Create New Record - Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
describe('Positive Tests', () => {
it('Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
agilite.BatchActions.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.BatchActions.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('parentId')
expect(response.data.data.parentId).to.equal(null)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data.actions.length).to.be.greaterThan(0)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('parentId')
expect(response.data.data.parentId).to.equal(null)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data.actions.length).to.be.greaterThan(0)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Data - Slim Result - Find Record By Id - Success', (done) => {
agilite.BatchActions.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
describe('Get Data', () => {
describe('Negative Tests', () => {})
for (const x in response.data) {
tmpEntry = response.data[x]
describe('Positive Tests', () => {
it('Slim Result - Find Record By Id - Success', (done) => {
agilite.BatchActions.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
for (const x in response.data) {
tmpEntry = response.data[x]
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - No Params (Negative)', (done) => {
agilite.BatchActions.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Update Existing Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.BatchActions.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Data Param (Negative)', (done) => {
agilite.BatchActions.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('No Data Param (Negative)', (done) => {
agilite.BatchActions.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Empty Object Data Param (Negative)', (done) => {
agilite.BatchActions.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Empty Object Data Param (Negative)', (done) => {
agilite.BatchActions.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.BatchActions.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.BatchActions.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Profile \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Profile 'key'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
describe('Positive Tests', () => {
it('Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
agilite.BatchActions.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.BatchActions.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(DataTemplate.modified.data.description)
expect(response.data.data).to.haveOwnProperty('parentId')
expect(response.data.data.parentId).to.equal(null)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data.actions.length).to.be.greaterThan(0)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(DataTemplate.modified.data.description)
expect(response.data.data).to.haveOwnProperty('parentId')
expect(response.data.data.parentId).to.equal(null)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data.actions.length).to.be.greaterThan(0)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Execute Batch Action - No Params (Negative)', (done) => {
agilite.BatchActions.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Execute', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.BatchActions.execute()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Profile Key was specified in the \'profile-key\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(
"No Profile Key was specified in the 'profile-key' header parameter"
)
})
.then(done, done)
})
.then(done, done)
})
it('Execute Batch Action - Invalid Key (Negative)', (done) => {
agilite.BatchActions.execute('invalid')
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Key (Negative)', (done) => {
agilite.BatchActions.execute('invalid')
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Active Profile cannot be found - invalid')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal('Active Profile cannot be found - invalid')
})
.then(done, done)
})
.then(done, done)
})
})
it('Execute Batch Action - Null as Data - Success', (done) => {
agilite.BatchActions.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Positive Tests', () => {
it('Null as Data - Success', (done) => {
agilite.BatchActions.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
})
.then(done, done)
})
.then(done, done)
})
it('Execute Batch Action - Object as Data - Success', (done) => {
agilite.BatchActions.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Object as Data - Success', (done) => {
agilite.BatchActions.execute(key, null)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - No Record Id (Negative)', (done) => {
agilite.BatchActions.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Delete Record', () => {
describe('Negative Tests', () => {
it('No Record Id (Negative)', (done) => {
agilite.BatchActions.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Delete Record - Invalid Record Id (Negative)', (done) => {
agilite.BatchActions.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Record Id (Negative)', (done) => {
agilite.BatchActions.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - Success', (done) => {
agilite.BatchActions.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
describe('Positive Tests', () => {
it('Success', (done) => {
agilite.BatchActions.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.then(done, done)
})
.then(done, done)
})
})
})

@@ -18,3 +18,3 @@ /* eslint-env mocha */

describe('Agilit-e Events', () => {
describe('Agilit-e Events \n', () => {
const invalidValue = 'invalid_value'

@@ -27,310 +27,387 @@

it('Create New Record - No Params (Negative)', (done) => {
agilite.Events.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Create New Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Events.postData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
it('Empty Object (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyObject))
agilite.Events.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Events.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Create New Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Events.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Events.postData(mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Event \'key\'')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Event 'key'")
})
.then(done, done)
})
.then(done, done)
})
})
it('Create New Record - Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
describe('Positive Tests', () => {
it('Success', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.new))
mainEntry.data.key = key
agilite.Events.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Events.postData(mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data).to.haveOwnProperty('subscriptions')
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data).to.haveOwnProperty('subscriptions')
// Store Record Id to be used later
recordId = response.data._id
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
.then(done, done)
})
})
it('Get Data - Slim Result - Find Record By Id - Success', (done) => {
agilite.Events.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
describe('Get Data', () => {
describe('Negative Tests', () => {})
for (const x in response.data) {
tmpEntry = response.data[x]
describe('Positive Tests', () => {
it('Slim Result - Find Record By Id - Success', (done) => {
agilite.Events.getData()
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.ARRAY)
expect(response.data.length).to.be.greaterThan(0)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
for (const x in response.data) {
tmpEntry = response.data[x]
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
expect(tmpEntry).to.haveOwnProperty('_id')
expect(tmpEntry._id).to.not.equal(Enums.STRING_EMPTY)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
if (tmpEntry._id === recordId) {
// Check that the values part of the slim result is returned
expect(tmpEntry).to.haveOwnProperty('data')
expect(tmpEntry.data).to.haveOwnProperty('isActive')
expect(TypeDetect(tmpEntry.data.isActive)).to.equal(EnumsTypeDetect.BOOLEAN)
expect(tmpEntry.data).to.haveOwnProperty('groupName')
expect(TypeDetect(tmpEntry.data.groupName)).to.equal(EnumsTypeDetect.STRING)
// Check that the values NOT part of the slim result aren't returned
expect(tmpEntry.createdBy).to.equal(undefined)
expect(tmpEntry.modifiedBy).to.equal(undefined)
expect(tmpEntry.createdAt).to.equal(undefined)
expect(tmpEntry.updatedAt).to.equal(undefined)
expect(tmpEntry.__v).to.equal(undefined)
}
}
})
.then(done, done)
})
.then(done, done)
})
})
it('Update Existing Record - No Params (Negative)', (done) => {
agilite.Events.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Update Existing Record', () => {
describe('Negative Tests', () => {
it('No Params (Negative)', (done) => {
agilite.Events.putData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Data Param (Negative)', (done) => {
agilite.Events.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('No Data Param (Negative)', (done) => {
agilite.Events.putData(recordId)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
})
.then(done, done)
})
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Update Existing Record - Empty Object Data Param (Negative)', (done) => {
agilite.Events.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No \'data\' property found in JSON Body')
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
it('Empty Object Data Param (Negative)', (done) => {
agilite.Events.putData(recordId, {})
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
agilite.Events.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a valid Event \'key\'')
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No 'data' property found in JSON Body")
})
.then(done, done)
})
.then(done, done)
})
it('Update Existing Record - Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
it('No Profile Key (Negative)', (done) => {
mainEntry = JSON.parse(JSON.stringify(DataTemplate.emptyDataObject))
agilite.Events.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
agilite.Events.putData(recordId, mainEntry)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(DataTemplate.modified.data.description)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data).to.haveOwnProperty('subscriptions')
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
// Store Record Id to be used later
recordId = response.data._id
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("Please provide a valid Event 'key'")
})
.then(done, done)
})
.then(done, done)
})
})
// it('Execute Event - No Params (Negative)', (done) => {
// agilite.Events.execute()
// .catch((err) => {
// expect(err).to.haveOwnProperty('response')
// expect(err.response.status).to.equal(400)
// expect(err.response).to.haveOwnProperty('data')
// expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
describe('Positive Tests', () => {
it('Success', (done) => {
key = 'PUT_' + key
mainEntry = JSON.parse(JSON.stringify(DataTemplate.modified))
mainEntry.data.key = key
// // Check if errorMessage exists and contains correct error message
// expect(err.response.data).to.haveOwnProperty('errorMessage')
// expect(err.response.data.errorMessage).to.equal('No Profile Key was specified in the \'profile-key\' header parameter')
// })
// .then(done, done)
// })
agilite.Events.putData(recordId, mainEntry)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// it('Execute Event - Invalid Key (Negative)', (done) => {
// agilite.Events.execute('invalid')
// .catch((err) => {
// expect(err).to.haveOwnProperty('response')
// expect(err.response.status).to.equal(400)
// expect(err.response).to.haveOwnProperty('data')
// expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if provided values match
expect(response.data.data).to.haveOwnProperty('key')
expect(response.data.data.key).to.equal(key)
expect(response.data.data).to.haveOwnProperty('groupName')
expect(response.data.data.groupName).to.equal(DataTemplate.modified.data.groupName)
expect(response.data.data).to.haveOwnProperty('description')
expect(response.data.data.description).to.equal(DataTemplate.modified.data.description)
expect(response.data.data).to.haveOwnProperty('actions')
expect(response.data.data).to.haveOwnProperty('subscriptions')
// // Check if errorMessage exists and contains correct error message
// expect(err.response.data).to.haveOwnProperty('errorMessage')
// expect(err.response.data.errorMessage).to.equal('Active Profile cannot be found - invalid')
// })
// .then(done, done)
// })
// Check if unprovided values exist and have defaults
expect(response.data).to.haveOwnProperty('_id')
expect(response.data._id).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('__v')
expect(TypeDetect(response.data.__v)).to.equal(EnumsTypeDetect.NUMBER)
expect(response.data).to.haveOwnProperty('createdBy')
expect(response.data.createdBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('modifiedBy')
expect(response.data.modifiedBy).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('createdAt')
expect(response.data.createdAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data).to.haveOwnProperty('updatedAt')
expect(response.data.updatedAt).to.not.equal(Enums.STRING_EMPTY)
expect(response.data.data).to.haveOwnProperty('isActive')
expect(response.data.data.isActive).to.equal(true)
// it('Execute Event - Null as Data - Success', (done) => {
// agilite.Events.execute(key, null)
// .then((response) => {
// expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// })
// .then(done, done)
// })
// Store Record Id to be used later
recordId = response.data._id
})
.then(done, done)
})
})
})
// it('Execute Event - Object as Data - Success', (done) => {
// agilite.Events.execute(key, null)
// .then((response) => {
// expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
// })
// .then(done, done)
// })
describe('Delete Record', () => {
describe('Negative Tests', () => {
it('No Record Id (Negative)', (done) => {
agilite.Events.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
it('Delete Record - No Record Id (Negative)', (done) => {
agilite.Events.deleteData()
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})
.then(done, done)
})
.then(done, done)
})
it('Delete Record - Invalid Record Id (Negative)', (done) => {
agilite.Events.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(err.response.status).to.equal(400)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
it('Invalid Record Id (Negative)', (done) => {
agilite.Events.deleteData(invalidValue)
.catch((err) => {
expect(err).to.haveOwnProperty('response')
expect(TypeDetect(err.response)).to.equal(EnumsTypeDetect.OBJECT)
expect(err.response).to.haveOwnProperty('status')
expect(TypeDetect(err.response.status)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.status).to.equal(400)
// Check if errorMessage exists and contains correct error message
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
expect(err.response).to.haveOwnProperty('data')
expect(TypeDetect(err.response.data)).to.equal(EnumsTypeDetect.OBJECT)
// Check props inside of data
expect(err.response.data).to.haveOwnProperty('statusCode')
expect(TypeDetect(err.response.data.statusCode)).to.equal(EnumsTypeDetect.NUMBER)
expect(err.response.data.statusCode).to.equal(400)
expect(err.response.data).to.haveOwnProperty('additionalMessages')
expect(TypeDetect(err.response.data.additionalMessages)).to.equal(EnumsTypeDetect.ARRAY)
expect(err.response.data.additionalMessages.length).to.equal(0)
expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(TypeDetect(err.response.data.errorMessage)).to.equal(EnumsTypeDetect.STRING)
expect(err.response.data.errorMessage).to.equal(`Record with id: '${invalidValue}' cannot be found`)
})
.then(done, done)
})
.then(done, done)
})
})
it('Delete Record - Success', (done) => {
agilite.Events.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
describe('Positive Tests', () => {
it('Success', (done) => {
agilite.Events.deleteData(recordId)
.then((response) => {
expect(TypeDetect(response.data)).to.equal(EnumsTypeDetect.OBJECT)
expect(JSON.stringify(response.data)).to.equal('{}')
})
.then(done, done)
})
.then(done, done)
})
})
})

@@ -53,3 +53,5 @@ /* eslint-env mocha */

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a File Name in the \'file-name\' header parameter')
expect(err.response.data.errorMessage).to.equal(
"Please provide a File Name in the 'file-name' header parameter"
)
})

@@ -70,3 +72,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a File Name in the \'file-name\' header parameter')
expect(err.response.data.errorMessage).to.equal(
"Please provide a File Name in the 'file-name' header parameter"
)
})

@@ -76,3 +80,4 @@ .then(done, done)

it('Empty Content-Type (String) & Empty Data (String) (NEGATIVE)', (done) => { // TODO: Breaks in Node-RED
it('Empty Content-Type (String) & Empty Data (String) (NEGATIVE)', (done) => {
// TODO: Breaks in Node-RED
agilite.Files.uploadFile('test', '', '', '', '')

@@ -109,3 +114,4 @@ .catch((err) => {

it('Empty Content-Type (Null) & Empty Data (Null) (NEGATIVE)', (done) => { // TODO: Odd error message in Node-RED
it('Empty Content-Type (Null) & Empty Data (Null) (NEGATIVE)', (done) => {
// TODO: Odd error message in Node-RED
agilite.Files.uploadFile('test', null, null, '', '')

@@ -153,3 +159,5 @@ .catch((err) => {

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a File Name in the \'file-name\' header parameter')
expect(err.response.data.errorMessage).to.equal(
"Please provide a File Name in the 'file-name' header parameter"
)
})

@@ -170,3 +178,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Please provide a File Name in the \'file-name\' header parameter')
expect(err.response.data.errorMessage).to.equal(
"Please provide a File Name in the 'file-name' header parameter"
)
})

@@ -187,3 +197,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Array of files found. Only 1 file can be uploaded at a time and should not be wrapped in an Array.')
expect(err.response.data.errorMessage).to.equal(
'Array of files found. Only 1 file can be uploaded at a time and should not be wrapped in an Array.'
)
})

@@ -454,3 +466,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -472,3 +484,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -478,3 +490,4 @@ .then(done, done)

it('String Record Id (NEGATIVE)', (done) => { // TODO: Not a descriptive enough error message in Node-RED
it('String Record Id (NEGATIVE)', (done) => {
// TODO: Not a descriptive enough error message in Node-RED
agilite.Files.getFile(invalidValue)

@@ -491,3 +504,5 @@ .catch((err) => {

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -524,3 +539,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -530,3 +545,4 @@ .then(done, done)

it('Object Record Id (NEGATIVE)', (done) => { // TODO: Not a descriptive enough error message in Node-RED
it('Object Record Id (NEGATIVE)', (done) => {
// TODO: Not a descriptive enough error message in Node-RED
agilite.Files.getFile({}, '', '')

@@ -542,3 +558,5 @@ .catch((err) => {

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -559,3 +577,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -576,3 +594,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -593,3 +611,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -610,3 +628,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -627,3 +645,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -644,3 +662,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -767,3 +785,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -784,3 +802,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -849,3 +867,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -882,3 +900,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -899,3 +917,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -916,3 +934,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -933,3 +953,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -950,3 +972,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -967,3 +991,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -1045,3 +1069,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -1062,3 +1086,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -1079,3 +1103,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -1096,3 +1122,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -1113,3 +1141,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -1228,3 +1256,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -1245,3 +1273,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -1262,3 +1292,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -1279,3 +1311,5 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('Argument passed in must be a single String of 12 bytes or a string of 24 hex characters')
expect(err.response.data.errorMessage).to.equal(
'Argument passed in must be a single String of 12 bytes or a string of 24 hex characters'
)
})

@@ -1296,3 +1330,3 @@ .then(done, done)

expect(err.response.data).to.haveOwnProperty('errorMessage')
expect(err.response.data.errorMessage).to.equal('No Id was specified in the \'record-id\' header parameter')
expect(err.response.data.errorMessage).to.equal("No Id was specified in the 'record-id' header parameter")
})

@@ -1299,0 +1333,0 @@ .then(done, done)

@@ -19,2 +19,2 @@ {

"include": ["src"]
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc