diff --git a/docconv_test.go b/docconv_test.go index 59a9602..39eaac0 100644 --- a/docconv_test.go +++ b/docconv_test.go @@ -1,39 +1,20 @@ package docconv import ( - "io" - "reflect" "strings" "testing" ) -func TestConvert(t *testing.T) { - tests := []struct { - name string - r io.Reader - mimeType string - readability bool - resp *Response - err error - }{ - { - name: "trims space", - mimeType: "text/plain", - r: strings.NewReader(" \n\n\nthe file\n\n"), - resp: &Response{ - Body: "the file", - }, - }, +func TestConvertTrimsSpace(t *testing.T) { + resp, err := Convert( + strings.NewReader(" \n\n\nthe \n file\n\n"), + "text/plain", + false, + ) + if err != nil { + t.Fatalf("got error = %v, want nil", err) } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, err := Convert(tt.r, tt.mimeType, tt.readability) - if err != tt.err { - t.Fatalf("Convert() error = %v, want %v", err, tt.err) - } - if !reflect.DeepEqual(got, tt.resp) { - t.Errorf("Convert() = %v, want %v", got, tt.resp) - } - }) + if want := "the \n file"; resp.Body != want { + t.Errorf("body = %v, want %v", resp.Body, want) } }