MCPcopy Index your code
hub / github.com/dnote/dnote / TestValidateBookName

Function TestValidateBookName

pkg/cli/validate/book_test.go:25–157  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestValidateBookName(t *testing.T) {
26 testCases := []struct {
27 input string
28 expected error
29 }{
30 {
31 input: "javascript",
32 expected: nil,
33 },
34 {
35 input: "node.js",
36 expected: nil,
37 },
38 {
39 input: "",
40 expected: ErrBookNameEmpty,
41 },
42 {
43 input: "foo bar",
44 expected: ErrBookNameHasSpace,
45 },
46 {
47 input: "123",
48 expected: ErrBookNameNumeric,
49 },
50 {
51 input: "+123",
52 expected: nil,
53 },
54 {
55 input: "-123",
56 expected: nil,
57 },
58 {
59 input: "+javascript",
60 expected: nil,
61 },
62 {
63 input: "0",
64 expected: ErrBookNameNumeric,
65 },
66 {
67 input: "0333",
68 expected: ErrBookNameNumeric,
69 },
70 {
71 input: " javascript",
72 expected: ErrBookNameHasSpace,
73 },
74 {
75 input: "java script",
76 expected: ErrBookNameHasSpace,
77 },
78 {
79 input: "javascript (1)",
80 expected: ErrBookNameHasSpace,
81 },
82 {

Callers

nothing calls this directly

Calls 2

EqualFunction · 0.92
BookNameFunction · 0.85

Tested by

no test coverage detected