Use `assert.ok`.

Use `assert.ok` for invariants instead of `if` statements that are going
to be hard to test because invariants are there to catch errors in the
code, not in the environment.