Could you add a test for `_rewriteHref` and `optimize`?