package fa import ( "strings" "testing" "github.com/PuerkitoBio/goquery" ) // A cursor page (/msg/submissions/new~{id}@72/) may render its gallery // without the #messagecenter-submissions wrapper the default view uses. // parseSubmissionInboxPage must still recover the submissions instead of // silently returning an empty page, which would truncate the crawl. func TestParseSubmissionInboxPage_FindsFiguresOutsideMessageCenter(t *testing.T) { html := ` ` doc, err := goquery.NewDocumentFromReader(strings.NewReader(html)) if err != nil { t.Fatal(err) } items, _ := parseSubmissionInboxPage(doc, false) if len(items) != 2 { t.Fatalf("got %d items; want 2", len(items)) } if items[0].ID != 501 || items[1].ID != 500 { t.Errorf("ids = %d, %d; want 501, 500", items[0].ID, items[1].ID) } }