From d4d0eadfa1298a661e3447110e2f48f64d3af91d Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sun, 16 Dec 2018 21:32:49 -0800 Subject: [PATCH] add typescript test --- test/integration/request-ts.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/integration/request-ts.ts diff --git a/test/integration/request-ts.ts b/test/integration/request-ts.ts new file mode 100644 index 00000000..00775384 --- /dev/null +++ b/test/integration/request-ts.ts @@ -0,0 +1,15 @@ +import { get } from "request"; + +const url = "https://dog.ceo/api/breeds/image/random"; + +export default () => { + return new Promise((resolve, reject) => { + get(url, { json: true }, (err, resp, body) => { + if (err) return reject(err); + if (body.status != "success") { + return reject(new Error("Bad api response: " + JSON.stringify(body))); + } + resolve(); + }); + }); +};