Initial commit: LastRecc discovery feed and weekly engine
This commit is contained in:
40 files changed
+6972
No files matched your search
@@ -0,0 +1,24 @@
|
||||
package rip
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseSearchOutput(t *testing.T) {
|
||||
output := `results: 100
|
||||
1. id=dpkjsfxlbkrwa | Intimate Fonk
|
||||
results: 1
|
||||
1. id=dpkjsfxlbkrwa | Intimate Fonk
|
||||
`
|
||||
hits := parseSearchOutput(output)
|
||||
if len(hits) != 1 {
|
||||
t.Fatalf("expected 1 deduped hit, got %d", len(hits))
|
||||
}
|
||||
if hits[0].ID != "dpkjsfxlbkrwa" || hits[0].Title != "Intimate Fonk" {
|
||||
t.Fatalf("unexpected hit: %+v", hits[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseNoResults(t *testing.T) {
|
||||
if hits := parseSearchOutput("no results\n"); len(hits) != 0 {
|
||||
t.Fatalf("expected no hits, got %+v", hits)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user