Miss any of our Open RFC calls?Watch the recordings here! »

back-to-the-fixture

1.1.0 • Public • Published

Back to the Fixture

Simple recording & replaying of HTTP requests for predictable development & testing.

Example

Given a GraphQL server:

import { Recorder } from "back-to-the-fixture";
import graphql from "express-graphql";
 
export default graphql((req: Request, res: Response) => {
  // 👇 Pull ?mode=record or ?mode=replay
  const { mode } = req.query;
 
  // 👇 Create a recorder for this request
  new Recorder({ mode });
 
  return {
    graphiql: true,
    pretty: true,
    schema
  };
});

Fixtures are stored based on their URL with the name ${hash}.${user}.json:

.
└── __fixtures__
    └── api.github.com
        └── rate_limit
            └── 4280543676.all.json

This way, similar requests for different users/logins in your testing can be easily found.

Installation

yarn add --dev back-to-the-fixture

Keywords

none

Install

npm i back-to-the-fixture

DownloadsWeekly Downloads

11

Version

1.1.0

License

MIT

Unpacked Size

16.8 kB

Total Files

15

Last publish

Collaborators

  • avatar