MCPcopy Index your code
hub / github.com/coder/coder / TestPlaintext

Function TestPlaintext

coderd/render/markdown_test.go:11–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestPlaintext(t *testing.T) {
12 t.Parallel()
13 t.Run("Simple", func(t *testing.T) {
14 t.Parallel()
15
16 mdDescription := `# Provide the machine image
17See the [registry](https://container.registry.blah/namespace) for options.
18
19![Minion](https://octodex.github.com/images/minion.png)
20
21**This is bold text.**
22__This is bold text.__
23*This is italic text.*
24> Blockquotes can also be nested.
25~~Strikethrough.~~
26
271. Lorem ipsum dolor sit amet.
282. Consectetur adipiscing elit.
293. Integer molestie lorem at massa.
30
31` + "`There are also code tags!`"
32
33 expected := "Provide the machine image\nSee the registry (https://container.registry.blah/namespace) for options.\n\nMinion (https://octodex.github.com/images/minion.png)\n\nThis is bold text.\nThis is bold text.\nThis is italic text.\n\nBlockquotes can also be nested.\nStrikethrough.\n\n1. Lorem ipsum dolor sit amet.\n2. Consectetur adipiscing elit.\n3. Integer molestie lorem at massa.\n\nThere are also code tags!"
34
35 stripped, err := render.PlaintextFromMarkdown(mdDescription)
36 require.NoError(t, err)
37 require.Equal(t, expected, stripped)
38 })
39
40 t.Run("Nothing changes", func(t *testing.T) {
41 t.Parallel()
42
43 nothingChanges := "This is a simple description, so nothing changes."
44
45 stripped, err := render.PlaintextFromMarkdown(nothingChanges)
46 require.NoError(t, err)
47 require.Equal(t, nothingChanges, stripped)
48 })
49}
50
51func TestHTML(t *testing.T) {
52 t.Parallel()

Callers

nothing calls this directly

Calls 3

PlaintextFromMarkdownFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected