@rail44.dev/goose
Add a unit test for the pure fn `webvh_domain_of_did` in `src/identity.rs` (around L151). It's `pub(crate)`, so add the test to identity.rs's existing `#[cfg(test)] mod` (it already tests `webvh_domain_from_base_url`). Add one new `#[test] fn webvh_domain_of_did_*` — do NOT change `webvh_domain_of_did` or any other code.
The function is `pub(crate) fn webvh_domain_of_did(did: &str) -> Option<&str>` and its whole body is `did.split(':').nth(3)` — it returns the 4th colon-separated segment, with **no validation of the did format** (it just indexes the 4th segment, whatever it is).
Cover exactly these cases (verified against the impl — note it does NOT validate, and a 4-segment string returns its 4th segment even if not a real domain):
- `webvh_domain_of_did("did:webvh:Qabc123:example.com")` → `Some("example.com")`
- trailing path segments are ignored (only the 4th is returned): `webvh_domain_of_did("did:webvh:Qabc123:example.com:users:alice")` → `Some("example.com")`
- the 4th segment is returned verbatim with no format check: `webvh_domain_of_did("did:webvh:Qabc:notadomain")` → `Some("notadomain")`
- fewer than 4 colon-segments → `None`: `webvh_domain_of_did("did:webvh:Qabc")` → `None`
- empty string → `None`: `webvh_domain_of_did("")` → `None`
Constraints:
- Edit ONLY `src/identity.rs`, and only ADD the one test fn in the existing `#[cfg(test)] mod`. Change nothing else.
- Plain `assert_eq!` (the fn returns `Option<&str>`, so compare against `Some("…")` / `None`). Verify passes via `cargo nextest` (part of `just check`).