From f58ad00fec07aa2512afd621f30d1dd377112218 Mon Sep 17 00:00:00 2001 From: genofire Date: Wed, 13 Nov 2019 12:21:50 +0100 Subject: [PATCH] [TEST] add output raw --- output/raw/output_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 output/raw/output_test.go diff --git a/output/raw/output_test.go b/output/raw/output_test.go new file mode 100644 index 0000000..925418d --- /dev/null +++ b/output/raw/output_test.go @@ -0,0 +1,28 @@ +package raw + +import ( + "os" + "testing" + + "github.com/FreifunkBremen/yanic/runtime" + "github.com/stretchr/testify/assert" +) + +func TestOutput(t *testing.T) { + assert := assert.New(t) + + out, err := Register(map[string]interface{}{}) + assert.Error(err) + assert.Nil(out) + + out, err = Register(map[string]interface{}{ + "path": "/tmp/raw.json", + }) + os.Remove("/tmp/raw.json") + assert.NoError(err) + assert.NotNil(out) + + out.Save(&runtime.Nodes{}) + _, err = os.Stat("/tmp/raw.json") + assert.NoError(err) +}