Comparing version 0.1.6 to 0.1.7
@@ -43,3 +43,3 @@ import { PostMessageOptions } from './testMethods'; | ||
reciever?: string; | ||
additionalNormalizer?: (msg: any) => any; | ||
normalizer?: (msg: any) => any; | ||
timeout?: number; | ||
@@ -69,8 +69,8 @@ skipNormalization?: boolean; | ||
uploadFile(filepath: string, opts?: UploadFileOptions): PromiseLike<any>; | ||
sleep(time: number): q.Promise<void>; | ||
getLastMessage(reciever?: string): PromiseLike<Message>; | ||
sleep(time?: number): q.Promise<void>; | ||
getLastMessage(onlyString?: boolean, reciever?: string): PromiseLike<Message | string>; | ||
waitForResponseToBe(target: object | string, opts?: WaitForResponseOptions): q.Promise<{}>; | ||
waitForFileShare(reciever?: string): q.Promise<any>; | ||
waitForFileShare(reciever?: string, timeout?: number): q.Promise<any>; | ||
wait(method: (() => any | PromiseLike<any>) | PromiseLike<any>, message?: string, timeout?: number): q.Promise<any>; | ||
private waitForMessageAfterTs(timestamp, reciever?); | ||
} |
@@ -12,3 +12,3 @@ "use strict"; | ||
const message_1 = require("./../platforms/message"); | ||
const jsondiffpatch = require("jsondiffpatch"); | ||
const diff_1 = require("../diff"); | ||
const q = require("q"); | ||
@@ -54,7 +54,10 @@ const path = require("path"); | ||
} | ||
sleep(time) { | ||
sleep(time = 0) { | ||
return q.delay(time); | ||
} | ||
getLastMessage(reciever) { | ||
return this.platform.getLastMessage(reciever); | ||
getLastMessage(onlyString = false, reciever) { | ||
return this.platform.getLastMessage(reciever) | ||
.then((msg) => { | ||
return (onlyString) ? msg.text : msg; | ||
}); | ||
} | ||
@@ -67,3 +70,3 @@ waitForResponseToBe(target, opts = {}) { | ||
try { | ||
latestDelta = this.platform.compare(message.payload, target, opts.additionalNormalizer, opts.skipNormalization); | ||
latestDelta = this.platform.compare(message.payload, target, opts.normalizer, opts.skipNormalization); | ||
//console.log(latestDelta, message); | ||
@@ -79,3 +82,3 @@ } | ||
if (latestDelta) { | ||
jsondiffpatch.console.log(latestDelta); | ||
diff_1.default.console.log(latestDelta); | ||
} | ||
@@ -85,9 +88,11 @@ return q.reject(err); | ||
} | ||
waitForFileShare(reciever) { | ||
waitForFileShare(reciever, timeout) { | ||
return method_utils_1.wait(() => { | ||
return this.platform.getLastMessage(reciever). | ||
then((message) => { | ||
return message.type === message_1.MessageTypes.FILE_SHARE; | ||
if (message.type === message_1.MessageTypes.FILE_SHARE) { | ||
return message; | ||
} | ||
}); | ||
}, 'File Upload'); | ||
}, 'File Upload', timeout); | ||
} | ||
@@ -94,0 +99,0 @@ wait(method, message, timeout) { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const logger_1 = require("./../logger"); | ||
const jsondiffpatch = require("jsondiffpatch"); | ||
const diff_1 = require("../diff"); | ||
const q = require("q"); | ||
@@ -49,3 +49,3 @@ let logger = new logger_1.Logger('Platform'); | ||
target = this.normalizeTarget(target); | ||
return jsondiffpatch.diff(normalizedSrc, target); | ||
return diff_1.default.diff(normalizedSrc, target); | ||
} | ||
@@ -52,0 +52,0 @@ getMessageType(message) { |
{ | ||
"name": "custody", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "e2e testing for chatbots", | ||
@@ -8,3 +8,4 @@ "main": "index.js", | ||
"build": "gulp", | ||
"test": "npm run build && istanbul cover jasmine && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" | ||
"test": "npm run build && istanbul cover jasmine && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", | ||
"prepublishOnly": "gulp prepublish" | ||
}, | ||
@@ -11,0 +12,0 @@ "repository": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
163070
89
2877
0