From 50c575b2f9cb3eb67316d35b5b04bc514f3726c5 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Sat, 3 Mar 2018 15:10:57 -0800 Subject: [PATCH] =?UTF-8?q?Explicitly=20test=20address=E2=86=94string=20fu?= =?UTF-8?q?nction=20error=20case=20(#63)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: `graph.js` coverage is now 100% :-) Test Plan: `yarn jest --env=jsdom --coverage` shows no uncovered lines for `graph.js`, and no failing tests. wchargin-branch: coverage-gremlin --- src/backend/graph.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/backend/graph.test.js b/src/backend/graph.test.js index a1e43c2..022fd5e 100644 --- a/src/backend/graph.test.js +++ b/src/backend/graph.test.js @@ -591,6 +591,14 @@ describe("graph", () => { it("rejects an Address with $-signs in id", () => { expectRejection("id", "issue$123"); }); + it("rejects a null address", () => { + expect(() => addressToString((null: any))).toThrow("address is null"); + }); + it("rejects a undefined address", () => { + expect(() => addressToString((undefined: any))).toThrow( + "address is undefined" + ); + }); }); describe("stringToAddress", () => { @@ -610,6 +618,16 @@ describe("graph", () => { expect(() => stringToAddress(input)).toThrow(/exactly two \$s/); }); }); + it("rejects a null address string", () => { + expect(() => stringToAddress((null: any))).toThrow( + "address string is null" + ); + }); + it("rejects a undefined address string", () => { + expect(() => stringToAddress((undefined: any))).toThrow( + "address string is undefined" + ); + }); }); describe("stringToAddress and addressToString interop", () => {