回答編集履歴
2
修正
answer
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
}
|
25
25
|
|
26
26
|
// ダミー関数を注入
|
27
|
-
|
27
|
+
results := GetArticleService(dummyFunc)
|
28
28
|
```
|
29
29
|
|
30
30
|
もしくは関数そのものでなく関数を持つ `interface` を定義してそれを差し替えるという方法も考えられます。
|
1
修正
answer
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
```
|
20
20
|
func TestGetArticleService(t *testing.T) {
|
21
21
|
// 決まった値を返すダミー関数
|
22
|
-
dummyFunc := func (
|
22
|
+
dummyFunc := func () []Result {
|
23
23
|
return []Result{Result{}}
|
24
24
|
}
|
25
25
|
|