...
1 package name
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/require"
7 )
8
9 func Test_Name_Resource(t *testing.T) {
10 r := require.New(t)
11 table := []struct {
12 V string
13 E string
14 }{
15 {V: "Person", E: "People"},
16 {V: "foo_bar", E: "FooBars"},
17 {V: "admin/widget", E: "AdminWidgets"},
18 {V: "widget", E: "Widgets"},
19 {V: "widgets", E: "Widgets"},
20 {V: "greatPerson", E: "GreatPeople"},
21 {V: "great/person", E: "GreatPeople"},
22 {V: "status", E: "Statuses"},
23 {V: "Status", E: "Statuses"},
24 {V: "Statuses", E: "Statuses"},
25 {V: "statuses", E: "Statuses"},
26 }
27 for _, tt := range table {
28 r.Equal(tt.E, New(tt.V).Resource().String())
29 }
30 }
31
View as plain text