-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdot_test.go
37 lines (26 loc) · 958 Bytes
/
dot_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
package incr
import (
"bytes"
"strings"
"testing"
"github.com/wcharczuk/go-incr/testutil"
)
func Test_Dot(t *testing.T) {
g := New()
v0 := Var(g, "foo")
v1 := Var(g, "bar")
m2 := Map2(g, v0, v1, concat)
m3 := Map2(g, m2, Return(g, "const"), concat)
s := Sentinel(g, func() bool { return true }, m2)
o := MustObserve(g, m3)
buffer := new(bytes.Buffer)
err := Dot(buffer, g)
testutil.NoError(t, err)
testutil.NotEqual(t, "", buffer.String())
testutil.Equal(t, true, strings.Contains(buffer.String(), o.Node().id.Short()))
testutil.Equal(t, true, strings.Contains(buffer.String(), s.Node().id.Short()))
testutil.Equal(t, true, strings.Contains(buffer.String(), m2.Node().id.Short()))
testutil.Equal(t, true, strings.Contains(buffer.String(), m3.Node().id.Short()))
testutil.Equal(t, true, strings.Contains(buffer.String(), v0.Node().id.Short()))
testutil.Equal(t, true, strings.Contains(buffer.String(), v1.Node().id.Short()))
}