Fix address `toString` test case structure (#351)

Summary:
This fixes an organizational error on my part: the assertions were not
in `it`-blocks, so (a) no test cases were listed, and (b) assertion
failure would have been considered an error in the test suite itself.
(This wouldn’t have led to tests spuriously passing, though.)

Test Plan:
Note the new test case structure:

```
    nodeToString
      errors on
        ✓ null base input
        ✓ undefined base input
        ✓ wrong kind
      works on
        ✓ the empty address
        ✓ the address with one empty component
        ✓ a normal address
    edgeToString
      errors on
        ✓ null base input
        ✓ undefined base input
        ✓ wrong kind
      works on
        ✓ the empty address
        ✓ the address with one empty component
        ✓ a normal address
```

wchargin-branch: tostring-test-case-structure
This commit is contained in:
William Chargin 2018-06-06 11:47:39 -07:00 committed by GitHub
parent 1a8de82715
commit bc98383053
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 5 deletions

View File

@ -171,13 +171,19 @@ describe("core/address", () => {
describe("works on", () => {
const camelKind = kind.charAt(0).toLowerCase() + kind.substring(1);
test("the empty address", () => {
expect(f(goodConstructor([]))).toEqual(`${camelKind}([])`);
});
test("the address with one empty component", () => {
expect(f(goodConstructor([""]))).toEqual(`${camelKind}([""])`);
});
test("a normal address", () => {
expect(f(goodConstructor(["one", "", "two"]))).toEqual(
`${camelKind}(["one","","two"])`
);
});
});
});
}
checkToString(nodeToString, "NodeAddress", nodeAddress, edgeAddress);
checkToString(edgeToString, "EdgeAddress", edgeAddress, nodeAddress);