Explicitly test address↔string function error case (#63)

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
This commit is contained in:
William Chargin 2018-03-03 15:10:57 -08:00 committed by GitHub
parent 9b203e8489
commit 50c575b2f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -591,6 +591,14 @@ describe("graph", () => {
it("rejects an Address with $-signs in id", () => { it("rejects an Address with $-signs in id", () => {
expectRejection("id", "issue$123"); 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", () => { describe("stringToAddress", () => {
@ -610,6 +618,16 @@ describe("graph", () => {
expect(() => stringToAddress(input)).toThrow(/exactly two \$s/); 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", () => { describe("stringToAddress and addressToString interop", () => {