content/flux/v0/stdlib/testing/load.md
testing.load() loads test data from a stream of tables.
(<-tables: A) => A
{{% caption %}} For more information, see Function type signatures. {{% /caption %}}
Input data. Default is piped-forward data (<-).
The following test uses array.from() to create two streams of tables to
compare in the test.
import "testing"
import "array"
got =
array.from(
rows: [
{_time: 2021-01-01T00:00:00Z, _measurement: "m", _field: "t", _value: 1.2},
{_time: 2021-01-01T01:00:00Z, _measurement: "m", _field: "t", _value: 0.8},
{_time: 2021-01-01T02:00:00Z, _measurement: "m", _field: "t", _value: 3.2},
],
)
want =
array.from(
rows: [
{_time: 2021-01-01T00:00:00Z, _measurement: "m", _field: "t", _value: 1.2},
{_time: 2021-01-01T01:00:00Z, _measurement: "m", _field: "t", _value: 0.8},
{_time: 2021-01-01T02:00:00Z, _measurement: "m", _field: "t", _value: 3.1},
],
)
testing.load(tables: got)
|> testing.diff(want: want)