-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f4a501e
commit f8dcce9
Showing
71 changed files
with
11 additions
and
4,729 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,7 @@ | ||
# `graphql-validate-fixtures` | ||
|
||
[![Build Status](https://github.com/Shopify/quilt/workflows/Node-CI/badge.svg?branch=main)](https://github.com/Shopify/quilt/actions?query=workflow%3ANode-CI) | ||
[![Build Status](https://github.com/Shopify/quilt/workflows/Ruby-CI/badge.svg?branch=main)](https://github.com/Shopify/quilt/actions?query=workflow%3ARuby-CI) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE.md) [![npm version](https://badge.fury.io/js/graphql-validate-fixtures.svg)](https://badge.fury.io/js/graphql-validate-fixtures.svg) | ||
⚠️ DEPRECATED | ||
|
||
Validates JSON fixtures for GraphQL responses against the associated operations and schema. | ||
This package has been deprecated and should no longer be used. | ||
|
||
## Installation | ||
|
||
```bash | ||
yarn add graphql-validate-fixtures | ||
``` | ||
|
||
## Usage | ||
|
||
In order to associate a fixture with a GraphQL query or mutation in your app, you must follow one of these conventions: | ||
|
||
- Your fixtures are in a directory with a name matching that of the associated GraphQL operation | ||
- Your fixtures have a key called `@operation` at the top level, which has a string value that is the name of the associated operation | ||
|
||
Once this is done, you can validate your fixtures using the CLI or Node.js API. | ||
|
||
### Operation | ||
|
||
On startup this tool performs the following actions: | ||
|
||
- Loads all schemas | ||
- Discovers all operations belonging to each schema | ||
- Discovers all fixtures and infers operation names as described [above](#Usage) | ||
- Validates fixtures against the operation with a matching name | ||
- Reports operation not found error if no schema matches | ||
- Reports ambiguous operation name error if more than one schema matches | ||
|
||
### Configuration | ||
|
||
This tool reads schema information from a [`graphql-config` config file](https://the-guild.dev/graphql/config/docs/user/usage) in the project root. | ||
|
||
### CLI | ||
|
||
```sh | ||
# Must provide a list of fixtures as the first argument | ||
yarn run graphql-validate-fixtures 'src/**/fixtures/**/*.graphql.json' | ||
``` | ||
|
||
### Node | ||
|
||
```js | ||
const {evaluateFixtures} = require('graphql-validate-fixtures'); | ||
evaluateFixtures({ | ||
fixturePaths: ['test/fixtures/one.json', 'test/fixtures/two.json'], | ||
}).then((results) => { | ||
// See the TypeScript definition file for more details on the | ||
// structure of the `results` | ||
results.forEach((result) => console.log(result)); | ||
}); | ||
``` | ||
For legacy documentation, see [v3.3.0](https://github.com/Shopify/quilt/blob/graphql-validate-fixtures%403.3.0/packages/graphql-validate-fixtures/README.md). |
2 changes: 0 additions & 2 deletions
2
packages/graphql-validate-fixtures/bin/graphql-validate-fixtures
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.