package myersdiffdemo import ( "strings" "testing" "gno.land/p/nt/uassert/v0" ) func TestUnknownPathFallsBackToTheIndex(t *testing.T) { index := Render("") uassert.Equal(t, index, Render("/")) uassert.Equal(t, index, Render("/nope")) uassert.Equal(t, index, Render("/patch2")) } // TestNoCallerEchoOnThePage is the escaping question asked the only way that // settles it: feed the path every construct the sanitizer exists to stop, then // assert none of it reached the page. This realm answers by never rendering a // caller string at all, so the assertion is that the output is byte-identical // to the index. func TestNoCallerEchoOnThePage(t *testing.T) { index := Render("") hostile := []string{ "/[click](https://evil.example)", "/![x](https://evil.example/p.png)", "/", "/a`b", "/x\ny", "/patch/[link](https://evil.example)", } for _, p := range hostile { got := Render(p) uassert.False(t, strings.Contains(got, "evil.example"), "a caller URL reached the page") uassert.False(t, strings.Contains(got, "