MCPcopy Create free account
hub / github.com/goadesign/goa / TestSSE

Function TestSSE

http/codegen/sse_server_test.go:14–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestSSE(t *testing.T) {
15 cases := []struct {
16 Name string
17 DSL func()
18 }{
19 {"string", testdata.SSEStringDSL},
20 {"int", testdata.SSEIntDSL},
21 {"bool", testdata.SSEBoolDSL},
22 {"object", testdata.SSEObjectDSL},
23 {"data-field", testdata.SSEDataFieldDSL},
24 {"data-id-field", testdata.SSEDataIDFieldDSL},
25 {"request-id", testdata.SSERequestIDDSL},
26 {"all-fields", testdata.SSEAllFieldsDSL},
27 }
28
29 for _, c := range cases {
30 t.Run(c.Name, func(t *testing.T) {
31 root := RunHTTPDSL(t, c.DSL)
32 services := CreateHTTPServices(root)
33 fs := ServerFiles("", services)
34 require.Len(t, fs, 3)
35 sections := fs[1].SectionTemplates
36 require.Greater(t, len(sections), 1)
37 code := codegen.SectionCode(t, sections[1])
38 golden := filepath.Join("testdata", "golden", "sse-"+c.Name+".golden")
39 testutil.CompareOrUpdateGolden(t, code, golden)
40 })
41 }
42}

Callers

nothing calls this directly

Calls 6

SectionCodeFunction · 0.92
CompareOrUpdateGoldenFunction · 0.92
RunHTTPDSLFunction · 0.85
CreateHTTPServicesFunction · 0.85
ServerFilesFunction · 0.70
RunMethod · 0.45

Tested by

no test coverage detected