|
| 1 | +package namer_test |
| 2 | + |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | + |
| 6 | + "github.com/stretchr/testify/assert" |
| 7 | + "github.com/stretchr/testify/require" |
| 8 | + |
| 9 | + "github.com/tarantool/go-storage/namer" |
| 10 | +) |
| 11 | + |
| 12 | +const ( |
| 13 | + defaultName = "all" |
| 14 | + defaultType = namer.KeyTypeHash |
| 15 | + defaultProperty = "sha256" |
| 16 | + defaultRaw = "/config/hash/sha256/all" |
| 17 | +) |
| 18 | + |
| 19 | +func TestNewDefaultKey(t *testing.T) { |
| 20 | + a := namer.NewDefaultKey(defaultName, defaultType, defaultProperty, defaultRaw) |
| 21 | + require.NotEmpty(t, a) |
| 22 | +} |
| 23 | + |
| 24 | +func TestDefaultKey_Build(t *testing.T) { |
| 25 | + a := namer.NewDefaultKey(defaultName, defaultType, defaultProperty, defaultRaw) |
| 26 | + require.Equal(t, defaultRaw, a.Build()) |
| 27 | +} |
| 28 | + |
| 29 | +func TestDefaultKey_Name(t *testing.T) { |
| 30 | + a := namer.NewDefaultKey(defaultName, defaultType, defaultProperty, defaultRaw) |
| 31 | + assert.Equal(t, defaultName, a.Name()) |
| 32 | +} |
| 33 | + |
| 34 | +func TestDefaultKey_Type(t *testing.T) { |
| 35 | + a := namer.NewDefaultKey(defaultName, defaultType, defaultProperty, defaultRaw) |
| 36 | + assert.Equal(t, defaultType, a.Type()) |
| 37 | +} |
| 38 | + |
| 39 | +func TestDefaultKey_Property(t *testing.T) { |
| 40 | + a := namer.NewDefaultKey(defaultName, defaultType, defaultProperty, defaultRaw) |
| 41 | + assert.Equal(t, defaultProperty, a.Property()) |
| 42 | +} |
0 commit comments