@cryptotaxi247 / kubo / commits / fb187e49e

test(2/diag) test print diagnostics

License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Nov 12, 2014 at 22:30 UTC fb187e49e3e3075c22c360e3eb8384d51df8af51
1 file changed +29
core/commands2/diag_test.go new
+29
@@ -0,0 +1,29 @@
1 +package commands
2 +
3 +import (
4 + "bytes"
5 + "testing"
6 +)
7 +
8 +func TestPrintDiagnostics(t *testing.T) {
9 + output := DiagnosticOutput{
10 + Peers: []DiagnosticPeer{
11 + DiagnosticPeer{ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg",
12 + UptimeSeconds: 14,
13 + Connections: []DiagnosticConnection{
14 + DiagnosticConnection{ID: "QmNrjRuUtBNZAigzLRdZGN1YCNUxdF2WY2HnKyEFJqoTeg",
15 + NanosecondsLatency: 1347899,
16 + },
17 + },
18 + },
19 + DiagnosticPeer{ID: "QmUaUZDp6QWJabBYSKfiNmXLAXD8HNKnWZh9Zoz6Zri9Ti",
20 + UptimeSeconds: 14,
21 + },
22 + },
23 + }
24 + var buf bytes.Buffer
25 + if err := printDiagnostics(&buf, &output); err != nil {
26 + t.Fatal(err)
27 + }
28 + t.Log(buf.String())
29 +}