MCPcopy
hub / github.com/cayleygraph/cayley / TestStreamEncoder

Function TestStreamEncoder

internal/gephi/stream_test.go:11–20  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestStreamEncoder(t *testing.T) {
12 buf := bytes.NewBuffer(nil)
13 gs := NewGraphStream(buf)
14 p := map[quad.Value]quad.Value{iriPosX: quad.Float(0), iriPosY: quad.Float(0)}
15 gs.AddNode(quad.String("aaa"), p)
16 gs.AddNode(quad.String("bbb"), p)
17 gs.Flush()
18 const expect = "{\"an\":{\"0\":{\"label\":\"aaa\",\"size\":20,\"x\":0,\"y\":0}}}\r\n{\"an\":{\"1\":{\"label\":\"bbb\",\"size\":20,\"x\":0,\"y\":0}}}\r\n"
19 require.Equal(t, expect, buf.String())
20}

Callers

nothing calls this directly

Calls 4

AddNodeMethod · 0.95
FlushMethod · 0.95
NewGraphStreamFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected