@@ -125,146 +125,14 @@ describe("Function Tests", () => {
125125
126126### Core Functions
127127
128- #### ` loadFixture(fixturePath) `
129-
130- Loads a fixture file from the specified path.
131-
132- ** Parameters:**
133-
134- - ` fixturePath ` (string): Path to the fixture JSON file
135-
136- ** Returns:** Promise<FixtureData > - Fixture object containing ` export ` , ` input ` , ` expectedOutput ` , and ` target `
137-
138- ** Example:**
139-
140- ``` javascript
141- const fixture = await loadFixture (" ./fixtures/my-test.json" );
142- ```
143-
144- ---
145-
146- #### ` loadSchema(schemaPath) `
147-
148- Loads a GraphQL schema from a file.
149-
150- ** Parameters:**
151-
152- - ` schemaPath ` (string): Path to the schema.graphql file
153-
154- ** Returns:** Promise<GraphQLSchema > - Parsed GraphQL schema
155-
156- ** Example:**
157-
158- ``` javascript
159- const schema = await loadSchema (" ./schema.graphql" );
160- ```
161-
162- ---
163-
164- #### ` loadInputQuery(queryPath) `
165-
166- Loads and parses a GraphQL input query.
167-
168- ** Parameters:**
169-
170- - ` queryPath ` (string): Path to the GraphQL query file
171-
172- ** Returns:** Promise<DocumentNode > - Parsed GraphQL query AST
173-
174- ** Example:**
175-
176- ``` javascript
177- const inputQueryAST = await loadInputQuery (" ./src/run.graphql" );
178- ```
179-
180- ---
181-
182- #### ` validateTestAssets(options) `
183-
184- Validates test assets including input query, fixture input/output, and query-fixture match.
185-
186- ** Parameters:**
187-
188- - ` options ` (ValidateTestAssetsOptions):
189- - ` schema ` (GraphQLSchema): The GraphQL schema
190- - ` fixture ` (FixtureData): The fixture to validate
191- - ` inputQueryAST ` (DocumentNode): The input query AST
192- - ` mutationName ` (string, optional): The mutation name (auto-detected if not provided)
193- - ` resultParameterName ` (string, optional): The result parameter name (auto-detected if not provided)
194-
195- ** Returns:** Promise<CompleteValidationResult > - Validation results for all validation steps:
196-
197- - ` inputQuery ` : { valid: boolean, errors: readonly GraphQLError[ ] }
198- - ` inputFixture ` : { valid: boolean, errors: string[ ] , data: any }
199- - ` inputQueryFixtureMatch ` : { valid: boolean, errors: string[ ] }
200- - ` outputFixture ` : { valid: boolean, errors: { message: string }[ ] , mutationName: string | null, resultParameterType: string | null }
201- - ` mutationName? ` : string - Auto-detected mutation name
202- - ` resultParameterName? ` : string - Auto-detected result parameter name
203- - ` error? ` : string - Top-level error if validation fails
204-
205- ** Example:**
206-
207- ``` javascript
208- const validationResult = await validateTestAssets ({
209- schema,
210- fixture,
211- inputQueryAST,
212- });
213-
214- // Log validation results
215- console .log (` Input Query: ${ validationResult .inputQuery .valid ? ' ✅' : ' ❌' } ` );
216- console .log (` Input Fixture: ${ validationResult .inputFixture .valid ? ' ✅' : ' ❌' } ` );
217- console .log (` Input Query-Fixture Match: ${ validationResult .inputQueryFixtureMatch .valid ? ' ✅' : ' ❌' } ` );
218- console .log (` Output Fixture: ${ validationResult .outputFixture .valid ? ' ✅' : ' ❌' } ` );
219- ```
220-
221- ---
222-
223- #### ` buildFunction(functionPath?) `
224-
225- Builds a Shopify function using the Shopify CLI.
226-
227- ** Parameters:**
228-
229- - ` functionPath ` (string, optional): Path to the function directory. If not provided, will auto-detect from current working directory.
230-
231- ** Returns:** Promise<BuildFunctionResult > - Build result with ` success ` , ` output ` , and ` error ` properties
232-
233- ** Example:**
234-
235- ``` javascript
236- const buildResult = await buildFunction (" /path/to/function" );
237- if (! buildResult .success ) {
238- console .error (" Build failed:" , buildResult .error );
239- }
240- ```
241-
242- ---
243-
244- #### ` runFunction(exportName, input, functionPath?) `
245-
246- Runs a Shopify function using the Shopify CLI.
247-
248- ** Parameters:**
249-
250- - ` exportName ` (string): The export name of the function to run
251- - ` input ` (object): The input data to pass to the function
252- - ` functionPath ` (string, optional): Path to the function directory. If not provided, will auto-detect from current working directory.
253-
254- ** Returns:** Promise<RunFunctionResult > - Result object with:
255- - ` result ` : { output: any } | null - The function execution result
256- - ` error ` : string | null - Error message if execution failed
257-
258- ** Example:**
259-
260- ``` javascript
261- const runResult = await runFunction (" run" , fixtureInput, " /path/to/function" );
262- console .log (" Function output:" , runResult .result .output );
263- ```
264-
265- ** Note:** Both ` buildFunction ` and ` runFunction ` will automatically detect the function directory by looking for ` shopify.function.toml ` in common locations (current directory, src/, functions/, extensions/).
266-
267- ---
128+ - [ ` loadFixture ` ] ( ./src/methods/load-fixture.ts ) - Load a fixture file from the specified path
129+ - [ ` loadSchema ` ] ( ./src/methods/load-schema.ts ) - Load a GraphQL schema from a file
130+ - [ ` loadInputQuery ` ] ( ./src/methods/load-input-query.ts ) - Load and parse a GraphQL input query
131+ - [ ` validateTestAssets ` ] ( ./src/methods/validate-fixture.ts ) - Validate test assets including input query, fixture input/output, and query-fixture match
132+ - [ ` buildFunction ` ] ( ./src/methods/build-function.ts ) - Build a Shopify function using the Shopify CLI
133+ - [ ` runFunction ` ] ( ./src/methods/run-function.ts ) - Run a Shopify function using the Shopify CLI
134+
135+ See [ wasm-testing-helpers.ts] ( ./src/wasm-testing-helpers.ts ) for all exported types.
268136
269137## Development
270138
0 commit comments