开发者社区> 镜像站> NPM> back-to-the-fixture
back-to-the-fixture
Given a GraphQL server:
Last updated 2 years ago by ericclemmons .
MIT · Original npm · Tarball · package.json
$ cnpm install back-to-the-fixture 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.0                                ...           latest (2 years ago)
  • 2.0.0-0                                ...           next (2 years ago)

5 Versions

  • 2.0.0-0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (20)
Dependents (0)
None