|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package themis
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"fmt"
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
@ -14,7 +15,7 @@ func TestFormatRows(t *testing.T) {
|
|
|
|
|
rows, err := store.db.Query("SELECT provinces.name, provinces.region, provinces.area, provinces.trade_node FROM provinces WHERE area = 'Gascony'")
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
|
|
fmtd, err := FormatRows(rows)
|
|
|
|
|
fmtd, err := FormatRows(context.Background(), rows)
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
assert.Equal(t, `| name | region | area | trade_node |
|
|
|
|
|
| -------- | ------ | ------- | ---------- |
|
|
|
|
@ -32,7 +33,7 @@ func TestFormatRowsAggregated(t *testing.T) {
|
|
|
|
|
rows, err := store.db.Query("SELECT count(1) as total, trade_node from provinces where region = 'France' group by trade_node")
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
|
|
fmtd, err := FormatRows(rows)
|
|
|
|
|
fmtd, err := FormatRows(context.Background(), rows)
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
assert.Equal(t, `| total | trade_node |
|
|
|
|
|
| ----- | --------------- |
|
|
|
|
|