Skip to content

Commit ed69db7

Browse files
Add basics of the tests for the transformers.TransformerGroup.TransformLinks() method
1 parent ce05b1b commit ed69db7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package transformers
2+
3+
import (
4+
"net/http"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
"github.com/stretchr/testify/mock"
9+
)
10+
11+
func TestTransformerGroup_TransformLinks(test *testing.T) {
12+
type args struct {
13+
links []string
14+
response *http.Response
15+
responseContent []byte
16+
}
17+
18+
for _, data := range []struct {
19+
name string
20+
transformers TransformerGroup
21+
args args
22+
wantLinks []string
23+
wantErr assert.ErrorAssertionFunc
24+
}{
25+
// TODO: Add test cases.
26+
} {
27+
test.Run(data.name, func(test *testing.T) {
28+
gotLinks, gotErr := data.transformers.TransformLinks(
29+
data.args.links,
30+
data.args.response,
31+
data.args.responseContent,
32+
)
33+
34+
for _, transformer := range data.transformers {
35+
mock.AssertExpectationsForObjects(test, transformer)
36+
}
37+
assert.Equal(test, data.wantLinks, gotLinks)
38+
data.wantErr(test, gotErr)
39+
})
40+
}
41+
}

0 commit comments

Comments
 (0)