-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathsuite_test.go
More file actions
43 lines (40 loc) · 1016 Bytes
/
suite_test.go
File metadata and controls
43 lines (40 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package codegen
import (
"testing"
"github.com/stretchr/testify/assert"
httpcodegen "goa.design/goa/v3/http/codegen"
"goa.design/plugins/v3/testing/codegen/testdata"
)
func TestGenerateSuiteTopLevel(t *testing.T) {
cases := map[string]struct {
DSL func()
Code map[string][]string
Path string
}{
"with-result": {
DSL: testdata.WithResultDSL,
Code: map[string][]string{
"suite-test": {testdata.SuiteTestWithResultCode},
},
Path: "with_result_service_suite_test.go",
},
"without-result": {
DSL: testdata.WithoutResultDSL,
Code: map[string][]string{
"suite-test": {testdata.SuiteTestWithoutResultCode},
},
Path: "without_result_service_suite_test.go",
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
root := httpcodegen.RunHTTPDSL(t, c.DSL)
svc := root.Services[0]
f := generateSuiteTopLevel("", "", root, svc)
assert.Equal(t, c.Path, f.Path)
for sec, secCode := range c.Code {
testCode(t, f, sec, secCode)
}
})
}
}