MCPcopy Create free account
hub / github.com/algolia/cli / TestPluralize

Function TestPluralize

pkg/utils/utils_test.go:9–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestPluralize(t *testing.T) {
10 tests := []struct {
11 name string
12 num int
13 thing string
14 expected string
15 }{
16 {
17 name: "zero, no plural",
18 num: 0,
19 thing: "sushi",
20 expected: "0 sushi",
21 },
22 {
23 name: "one, no plural",
24 num: 1,
25 thing: "sushi",
26 expected: "1 sushi",
27 },
28 {
29 name: "negative, no plural",
30 num: -10,
31 thing: "sushi",
32 expected: "-10 sushi",
33 },
34 {
35 name: "positive, plural",
36 num: 10,
37 thing: "sushi",
38 expected: "10 sushis",
39 },
40 }
41
42 for _, tt := range tests {
43 t.Run(tt.name, func(t *testing.T) {
44 assert.Equal(t, tt.expected, Pluralize(tt.num, tt.thing))
45 })
46 }
47}
48
49func TestContains(t *testing.T) {
50 tests := []struct {

Callers

nothing calls this directly

Calls 2

PluralizeFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected