-
Notifications
You must be signed in to change notification settings - Fork 0
/
value_type_test.go
63 lines (47 loc) · 1.23 KB
/
value_type_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package debefix
import (
"context"
"testing"
"github.com/google/uuid"
"gotest.tools/v3/assert"
)
func TestValueStatic(t *testing.T) {
ctx := context.Background()
expected := "test"
rd := NewResolvedData()
v := ValueStatic(expected)
rv, rok, err := v.ResolveValue(ctx, rd, MapValues{})
assert.NilError(t, err)
assert.Assert(t, rok)
assert.Equal(t, expected, rv)
}
func TestValueUUID(t *testing.T) {
ctx := context.Background()
expected := uuid.New()
rd := NewResolvedData()
v := ValueUUID(expected)
rv, rok, err := v.ResolveValue(ctx, rd, MapValues{})
assert.NilError(t, err)
assert.Assert(t, rok)
assert.Equal(t, expected, rv)
}
func TestValueUUIDRandom(t *testing.T) {
ctx := context.Background()
rd := NewResolvedData()
v := ValueUUIDRandom()
rv, rok, err := v.ResolveValue(ctx, rd, MapValues{})
assert.NilError(t, err)
assert.Assert(t, rok)
rvu, isType := rv.(uuid.UUID)
assert.Assert(t, isType && rvu != uuid.Nil)
}
func TestValueGenUUID(t *testing.T) {
ctx := context.Background()
rd := NewResolvedData()
v := ValueGenUUID()
rv, rok, err := v.ResolveValue(ctx, rd, MapValues{})
assert.NilError(t, err)
assert.Assert(t, rok)
rvu, isType := rv.(uuid.UUID)
assert.Assert(t, isType && rvu != uuid.Nil)
}