1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/wtf_tests/bargraph/bargraph_test.go
2018-11-28 14:47:06 +01:00

41 lines
676 B
Go

package bargraph_test
import (
"testing"
. "github.com/stretchr/testify/assert"
. "github.com/wtfutil/wtf/wtf"
)
// MakeData - Create sample data
func makeData() []Bar {
//this could come from config
const lineCount = 2
var stats [lineCount]Bar
stats[0] = Bar{
Label: "Jun 27, 2018",
Percent: 20,
}
stats[1] = Bar{
Label: "Jul 09, 2018",
Percent: 80,
}
return stats[:]
}
//TestOutput of the bargraph make string (BuildStars) function
func TestOutput(t *testing.T) {
result := BuildStars(makeData(), 20, "*")
Equal(t,
"Jun 27, 2018[[red]****[white] ] 20\nJul 09, 2018[[red]****************[white] ] 80\n",
result,
)
}