mirror of https://github.com/status-im/fathom.git
add test for count.fill func
This commit is contained in:
parent
4468b70601
commit
526a9aae28
|
@ -83,7 +83,6 @@ func CreatePageviewArchives() {
|
|||
}
|
||||
|
||||
func CreateVisitorArchives() {
|
||||
|
||||
stmt, err := db.Conn.Prepare(`
|
||||
SELECT
|
||||
COUNT(DISTINCT(pv.visitor_id)) AS count,
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package count
|
||||
|
||||
import(
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestFill(t *testing.T) {
|
||||
start := time.Date(2016, time.January, 1, 0, 0, 0, 0, time.Local)
|
||||
end := time.Date(2016, time.January, 5, 0, 0, 0, 0, time.Local)
|
||||
|
||||
points := []Point{
|
||||
Point{
|
||||
Label: start.Format("2006-01-01"),
|
||||
Value: 1,
|
||||
},
|
||||
Point {
|
||||
Label: end.Format("2006-01-01"),
|
||||
Value: 1,
|
||||
},
|
||||
}
|
||||
|
||||
filled := fill(start.Unix(), end.Unix(), points)
|
||||
if len(filled) != 5 {
|
||||
t.Error("Length of filled points slice does not match expected length")
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue