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

Function TestRandomName

coderd/coderdtest/coderdtest_test.go:35–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33}
34
35func TestRandomName(t *testing.T) {
36 t.Parallel()
37
38 for range 10 {
39 name := coderdtest.RandomName(t)
40
41 require.NotEmpty(t, name, "name should not be empty")
42 require.NotContains(t, name, "_", "name should not contain underscores")
43
44 // Should be title cased (e.g., "Happy Einstein").
45 words := strings.Split(name, " ")
46 require.Len(t, words, 2, "name should have exactly two words")
47 for _, word := range words {
48 firstRune := []rune(word)[0]
49 require.True(t, unicode.IsUpper(firstRune), "word %q should start with uppercase letter", word)
50 }
51 }
52}

Callers

nothing calls this directly

Calls 3

RandomNameFunction · 0.92
NotEmptyMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected