package nomad import ( "testing" ) var pageData = ` Nomad: An MMS µblog

Nomad

MMS attachment

Finally exploring the trail behind my apartment, of course in the rain.

` func TestFetch(t *testing.T) { p := Post{ Body: nomadLink(NewURLSource("https://localhost")), URL: NewStringSource(pageData), } err := p.Fetch() if err != nil { t.Fatal(err) } expectedBody := "Finally exploring the trail behind my apartment, of course in the rain. [nomad.wntrmute.net](https://localhost)" expectedImage := "https://nomad.sfo2.cdn.digitaloceanspaces.com/MM6f13e74faa6d643d654507c5bd9d8f53.jpg" if p.Body != expectedBody { t.Fatalf("have '%s', want '%s'", p.Body, expectedBody) } if p.Image.ID() != expectedImage { t.Fatalf("have '%s', want '%s'", p.Image, expectedImage) } }