Documentation
¶
Index ¶
- type Fixture
- type Fixtures
- func (fs *Fixtures) Get(captorName string) (interface{}, error)
- func (fs *Fixtures) GetAndParse(captorName string, value interface{}) error
- func (fs *Fixtures) Logs() []string
- func (fs *Fixtures) Parse()
- func (fs *Fixtures) Setup(ctx context.Context, graphqlClient *graphqlclient.Client) error
- func (fs *Fixtures) SetupUntil() *int
- func (fs *Fixtures) Teardown(ctx context.Context, graphqlClient *graphqlclient.Client) error
- func (fs *Fixtures) TeardownUntil() *int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fixture ¶
type Fixture struct {
Setup string // the graphql to seed the fixture (expect mutation.. could be query too? to just get some existing data, e.g., max of something)
Captors map[string]string // directives for capturing data from the setup response: key = captor name, the "logical name" of the captured value, value = the jsonpath ino the response to extract the value
Teardown *string // the graphql to remove the seeded fixture (expect delete mutation). optional, if no new fixture is created during setup.
// contains filtered or unexported fields
}
Fixture contains the setup, teardown logic for a piece of fixtures, and the data needs to be extracted (captured) from the fixture, e.g., IDs.
type Fixtures ¶
type Fixtures struct {
Fixtures []Fixture // a list of fixtures, to be setup in this sequence, and torn down in the reverse sequence
// contains filtered or unexported fields
}
func (*Fixtures) GetAndParse ¶
Get parses the data retrieved by given captorName into the desired value type
func (*Fixtures) Parse ¶
func (fs *Fixtures) Parse()
Parse does a few validations and parsing in the list of fixtures: - setup and teardown graphql can pass the graphql parser (at least syntactically correct),
- and extract the graphql variables (whose values will be filled from captures) at the same time
- no duplicates in captor names across all fixtures - captor name used in a fixture's setup must already be "captured" in previous fixture's captors - captor name used in a fixture's teardown must already be "captured" in previous + current fixture's captors The result of parsing is in fs.parsed and fs.parseErr
func (*Fixtures) Setup ¶
Setup calls each fixture's Setup (graphql call) in sequence, and captures the values from the responses.
func (*Fixtures) SetupUntil ¶
SetupUntil returns setupUntilIdx (can be nil)
func (*Fixtures) Teardown ¶
Teardown calls each fixture's Teardown (graphql call) in reverse sequence.
func (*Fixtures) TeardownUntil ¶
TeardownUntil returns teardownUntilIdx (can be nil)