Use memoization for `doc-uri`. Also update/simplify unit tests.