@@ -40,7 +40,38 @@ func TestConcurrentHandler_running(test *testing.T) {
40
40
links []crawler.SourcedLink
41
41
runHandler func (ctx context.Context , handler ConcurrentHandler )
42
42
}{
43
- // TODO: Add test cases.
43
+ {
44
+ name : "with the Run() method" ,
45
+ links : []crawler.SourcedLink {
46
+ {
47
+ SourceLink : "http://example.com/" ,
48
+ Link : "http://example.com/1" ,
49
+ },
50
+ {
51
+ SourceLink : "http://example.com/" ,
52
+ Link : "http://example.com/2" ,
53
+ },
54
+ },
55
+ runHandler : func (ctx context.Context , handler ConcurrentHandler ) {
56
+ handler .Run (ctx )
57
+ },
58
+ },
59
+ {
60
+ name : "with the RunConcurrently() method" ,
61
+ links : []crawler.SourcedLink {
62
+ {
63
+ SourceLink : "http://example.com/" ,
64
+ Link : "http://example.com/1" ,
65
+ },
66
+ {
67
+ SourceLink : "http://example.com/" ,
68
+ Link : "http://example.com/2" ,
69
+ },
70
+ },
71
+ runHandler : func (ctx context.Context , handler ConcurrentHandler ) {
72
+ handler .RunConcurrently (ctx , 10 )
73
+ },
74
+ },
44
75
} {
45
76
test .Run (data .name , func (test * testing.T ) {
46
77
innerHandler := new (MockLinkHandler )
0 commit comments