From 77079998d940ec32862538577c67d01ed1cd44e8 Mon Sep 17 00:00:00 2001 From: Kartik Agarwal Date: Thu, 7 Jun 2018 19:44:25 +0530 Subject: [PATCH] add test case for - if passed object is not a promise --- test/await-to-js.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/await-to-js.test.ts b/test/await-to-js.test.ts index 3fb53bb..12b7308 100644 --- a/test/await-to-js.test.ts +++ b/test/await-to-js.test.ts @@ -35,4 +35,13 @@ describe("Await to test", () => { expect(err.extraKey).toEqual(1) expect(err.error).toEqual("Error message") }) + + it("should return an error if passed object is not a promise", async () => { + const promise = {} + + const [err, data] = await to(promise) + + expect(err).toEqual("Error") + expect(data).toBeUndefined() + }) })