@flagpolejs/graphql-scenario

1.0.1 • Public • Published

graphql-scenario

Flagpole Add-On for GraphQL Testing

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);
    });
});

Readme

Keywords

none

Package Sidebar

Install

npm i @flagpolejs/graphql-scenario

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

16.6 kB

Total Files

18

Last publish

Collaborators

  • jasonbyrne