Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @ideal-postcodes/api-fixtures with all npm packages installed. Try it out:

var apiFixtures = require("@ideal-postcodes/api-fixtures")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@ideal-postcodes/api-fixtures v0.1.0

api-fixtures

Ideal Postcodes API Fixtures

Static test fixtures generated from api.ideal-postcodes.co.uk

CircleCI Coverage Status Try on RunKit

This library provides static HTTP API response data for api.ideal-postcodes.co.uk as JSON objects. Canned API responses are exported as Fixture objects, containing a JSON response body (body) and HTTP Status Code (httpStatus).

Fixtures are periodically regenerated with live API requests from api.ideal-postcodes.co.uk.

We use it internally as an initial line of testing to mock HTTP requests and stub out API client function calls.

Features

  • Static, importable JSON response payloads generated from api.ideal-postcodes.co.uk (ideal for mock HTTP requests or stubbing API clients)
  • HTTP request definition included
  • Periodically regenerated from live API responses
  • Typescript typings
  • Detailed, low level fixture and type documentation

Usage

Example

npm install @ideal-postcodes/api-fixtures
import { postcodes } from "@ideal-postcodes/api-fixtures";

// or 
// const { postcodes } = require("@ideal-postcodes/api-fixtures");

console.log(postcodes.success);

{
  url: "/v1/postcodes/SW1A2AA",
  httpStatus: 200,
  body: {
    "code": 2000,
    "message": "success",
    "results": [
      {
        "postcode": "SW1A 2AA",
        "postcode_inward": "2AA",
        "postcode_outward": "SW1A",
        "post_town": "LONDON",
        "dependant_locality": "",
        "double_dependant_locality": "",
        "thoroughfare": "Downing Street",
        "dependant_thoroughfare": "",
        "building_number": "10",
        "building_name": "",
        "department_name": "",
        "organisation_name": "Prime Minister & First Lord Of The Treasury",
        "udprn": 23747771,
        "umprn": "",
        "delivery_point_suffix": "1A",
        "line_1": "Prime Minister & First Lord Of The Treasury",
        "line_2": "10 Downing Street",
        "line_3": "",
        "premise": "10",
        //...etc

Quick Reference

License

Code is MIT

Data provided by API is for testing and integration purposes only for PAF Products

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free