Refactored to flow Hub Packaging directory structures
This commit is contained in:
29
test-harness/README.md
Normal file
29
test-harness/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Test Harness Support files
|
||||
|
||||
The test harness uses Redis event pub/sub to receive notifications from IVA Studio.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```javascript
|
||||
(async () => {
|
||||
webdis().publish(recognizedObject.workspaceId, {
|
||||
conversationId: recognizedObject.conversationId,
|
||||
input: recognizedObject.input,
|
||||
answers: recognizedObject.answers,
|
||||
});
|
||||
})()
|
||||
.catch((error) => {
|
||||
console.log(error.message);
|
||||
recognizedObject.answers.push("");
|
||||
recognizedObject.errorInfo = {
|
||||
...recognizedObject.errorInfo,
|
||||
label: {
|
||||
data: error.toJSON ? error.toJSON() : {},
|
||||
message: error.message,
|
||||
},
|
||||
};
|
||||
})
|
||||
.finally(() => {
|
||||
next();
|
||||
});
|
||||
```
|
||||
17
test-harness/_studio_dependencies/GlobalVariable/webdis.js
Normal file
17
test-harness/_studio_dependencies/GlobalVariable/webdis.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const webdisBaseURL = "https://iva.mortons.site/webdis/";
|
||||
|
||||
return {
|
||||
async publish(channel, message) {
|
||||
const str = JSON.stringify(message);
|
||||
const encodedStr = buffer.Buffer.from(str).toString("base64");
|
||||
let escapedStr = encodedStr.replace(/\//g, "%2f");
|
||||
escapedStr = escapedStr.replace(/\+/g, "%2B");
|
||||
|
||||
console.log(`webdis:PUBLISH/${channel}/${escapedStr}`);
|
||||
axios
|
||||
.post(webdisBaseURL, `PUBLISH/${channel}/${escapedStr}`)
|
||||
.then(function (response) {
|
||||
console.log(response.data);
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user