Documentation
¶
Index ¶
- func Dedent(input string) string
- func InsertRawDocument(conn plugins.Conn, id int, filepath string, content string) error
- func PrintExpectedDocument(doc *ExpectedDocument) string
- func PrintExpectedSelection(sel ExpectedSelection) string
- func RunTable[PluginConfig any, PluginType plugins.HoudiniPlugin[PluginConfig]](t *testing.T, table Table[PluginConfig, PluginType])
- func StrPtr(s string) *string
- func ValidateExpectedDocuments[PluginConfig any](t *testing.T, db plugins.DatabasePool[PluginConfig], ...)
- func WriteDatabaseSchema(conn plugins.Conn) error
- type ExpectedArgument
- type ExpectedArgumentValue
- type ExpectedArgumentValueChildren
- type ExpectedDirective
- type ExpectedDirectiveArgument
- type ExpectedDocument
- type ExpectedOperationVariable
- type ExpectedSelection
- type Plugin
- type Table
- type Test
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InsertRawDocument ¶
InsertRawDocument inserts a raw_documents row with the given id so fixtures that call LoadPendingQuery directly satisfy the documents.raw_document foreign key, exactly like the extraction step does in production.
func PrintExpectedDocument ¶
func PrintExpectedDocument(doc *ExpectedDocument) string
PrintExpectedDocument returns the GraphQL string representation of the given ExpectedDocument.
func PrintExpectedSelection ¶
func PrintExpectedSelection(sel ExpectedSelection) string
func ValidateExpectedDocuments ¶
func ValidateExpectedDocuments[PluginConfig any]( t *testing.T, db plugins.DatabasePool[PluginConfig], expectedDocs []ExpectedDocument, )
func WriteDatabaseSchema ¶
WriteDatabaseSchema creates the database schema.
Types ¶
type ExpectedArgument ¶
type ExpectedArgument struct {
ID int64
Name string
Value *ExpectedArgumentValue
}
type ExpectedArgumentValue ¶
type ExpectedArgumentValue struct {
Kind string
Raw string
Children []ExpectedArgumentValueChildren
}
type ExpectedArgumentValueChildren ¶
type ExpectedArgumentValueChildren struct {
Name string
Value *ExpectedArgumentValue
}
type ExpectedDirective ¶
type ExpectedDirective struct {
Name string
Arguments []ExpectedDirectiveArgument
}
type ExpectedDirectiveArgument ¶
type ExpectedDirectiveArgument struct {
Name string
Value *ExpectedArgumentValue
}
type ExpectedDocument ¶
type ExpectedDocument struct {
Name string
RawDocument int
Kind string // "query", "mutation", "subscription", or "fragment"
TypeCondition *string
Variables []ExpectedOperationVariable
Selections []ExpectedSelection
Directives []ExpectedDirective
}
expectedDocument represents an operation or fragment definition.
func ExpectedDoc ¶
func ExpectedDoc(query string) ExpectedDocument
ExpectedDoc parses a GraphQL query string and returns a slice of ExpectedDocument.
func (ExpectedDocument) WithVariables ¶
func (e ExpectedDocument) WithVariables(args ...ExpectedOperationVariable) ExpectedDocument
type ExpectedOperationVariable ¶
type ExpectedOperationVariable struct {
Document int
Name string
Type string
TypeModifiers string
DefaultValue *ExpectedArgumentValue
Directives []ExpectedDirective
}
type ExpectedSelection ¶
type ExpectedSelection struct {
ID int64
FieldName string
Alias *string
PathIndex int
Kind string // "field", "fragment", "inline_fragment", etc.
Arguments []ExpectedArgument
Directives []ExpectedDirective
Children []ExpectedSelection
}
type Table ¶
type Table[PluginConfig any, PluginType plugins.HoudiniPlugin[PluginConfig]] struct { Schema string ProjectConfig plugins.ProjectConfig Tests []Test[PluginConfig] Plugin Plugin[PluginConfig] SetupTest func(t *testing.T, plugin PluginType, test Test[PluginConfig]) PerformTest func(t *testing.T, plugin PluginType, test Test[PluginConfig]) VerifyTest func(t *testing.T, plugin PluginType, test Test[PluginConfig]) // SetupAlwaysPasses requires AfterExtract to succeed regardless of test.Pass. // Use this when test.Pass controls only PerformTest behavior (e.g. manifest // validation), not whether the pipeline setup itself is expected to fail. SetupAlwaysPasses bool }
type Test ¶
type Test[PluginConfig any] struct { Name string Pass bool Input []string Filepaths []string // optional per-document filepaths, parallel to Input Expected []ExpectedDocument Extra map[string]any ProjectConfig func(config *plugins.ProjectConfig) // substrings that must appear in the pipeline's error output. use on failing // tests to assert the user sees the intended validation message rather than // an opaque internal failure (a constraint violation, for example). asserted // against errors from every stage: the harness's own extract/validate setup // and the stages run by the default PerformTest. ExpectedErrors []string // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.