MCPcopy Index your code
hub / github.com/google/go-github / TestMarkdownService_Markdown

Function TestMarkdownService_Markdown

github/markdown_test.go:14–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestMarkdownService_Markdown(t *testing.T) {
15 t.Parallel()
16 client, mux, _ := setup(t)
17
18 input := &markdownRenderRequest{
19 Text: Ptr("# text #"),
20 Mode: Ptr("gfm"),
21 Context: Ptr("google/go-github"),
22 }
23 mux.HandleFunc("/markdown", func(w http.ResponseWriter, r *http.Request) {
24 testMethod(t, r, "POST")
25 testJSONBody(t, r, input)
26 fmt.Fprint(w, `<h1>text</h1>`)
27 })
28
29 ctx := t.Context()
30 md, _, err := client.Markdown.Render(ctx, "# text #", &MarkdownOptions{
31 Mode: "gfm",
32 Context: "google/go-github",
33 })
34 if err != nil {
35 t.Errorf("Render returned error: %v", err)
36 }
37
38 if want := "<h1>text</h1>"; want != md {
39 t.Errorf("Render returned %+v, want %+v", md, want)
40 }
41
42 const methodName = "Render"
43 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
44 got, resp, err := client.Markdown.Render(ctx, "# text #", &MarkdownOptions{
45 Mode: "gfm",
46 Context: "google/go-github",
47 })
48 if got != "" {
49 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
50 }
51 return resp, err
52 })
53}
54
55func TestMarkdownRenderRequest_Marshal(t *testing.T) {
56 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
testJSONBodyFunction · 0.85
RenderMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…