From b434572f41b4d9e734a2322209f08d1384dca83c Mon Sep 17 00:00:00 2001 From: Ethan Resnick Date: Mon, 19 Sep 2016 23:04:50 -0400 Subject: [PATCH] fixup tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that these tests aren’t currently passing on master either; the last PR only passed because travis didn’t actually run the tests: https://travis-ci.org/DefinitelyTyped/DefinitelyTyped/builds/160110579 --- twilio/twilio-tests.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/twilio/twilio-tests.ts b/twilio/twilio-tests.ts index 1fb9afa0a4..25c6915068 100644 --- a/twilio/twilio-tests.ts +++ b/twilio/twilio-tests.ts @@ -1,4 +1,5 @@ import * as twilio from './twilio'; +import * as Express from "express"; // Examples taken from https://twilio.github.io/twilio-node/ (v2.1.0) @@ -227,8 +228,12 @@ var token = capability.generate(120); /// Utilities twilio.validateRequest(token, str, 'http://example.herokuapp.com', { query: 'val' }); -twilio.validateExpressRequest({}, 'YOUR_TWILIO_AUTH_TOKEN'); -twilio.validateExpressRequest({}, 'YOUR_TWILIO_AUTH_TOKEN', {}); +twilio.validateExpressRequest(getMockExpressRequest(), 'YOUR_TWILIO_AUTH_TOKEN'); +twilio.validateExpressRequest(getMockExpressRequest(), 'YOUR_TWILIO_AUTH_TOKEN', {}); twilio.webhook({ validate: false }); twilio.webhook("MYAUTHTOKEN", { validate: false }); + +function getMockExpressRequest(): Express.Request { + return JSON.parse("{}"); +}