https://github.com/flagpolejs/graphql-scenario
Flagpole Add-On for GraphQL Testing
https://github.com/flagpolejs/graphql-scenario
Last synced: over 1 year ago
JSON representation
Flagpole Add-On for GraphQL Testing
- Host: GitHub
- URL: https://github.com/flagpolejs/graphql-scenario
- Owner: flagpolejs
- License: mit
- Created: 2022-01-14T02:06:03.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-15T17:05:59.000Z (over 4 years ago)
- Last Synced: 2024-04-24T01:22:33.569Z (about 2 years ago)
- Language: TypeScript
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# graphql-scenario
Flagpole Add-On for GraphQL Testing
```typescript
import flagpole from "flagpole";
import GraphQLScenario, { gql } from "@flagpolejs/graphql-scenario";
flagpole("SpaceX GraphQL API", async (suite) => {
suite
.scenario("Get Last 10 Launches", GraphQLScenario)
.open("https://api.spacex.land/graphql")
.setQuery(
gql`
query {
launchesPast(limit: 10) {
mission_name
launch_date_local
launch_site {
site_name_long
}
}
}
`
)
.next(async (context) => {
context.comment(context.response.body);
const launches = await context.exists("data.launchesPast");
launches.is.array();
launches.length.assert().equals(10);
});
});
```