Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ideal-postcodes/api-fixtures

ideal-postcodes242MIT1.3.0TypeScript support: included

api-fixtures

readme

Ideal Postcodes API Fixtures

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

ReleaseCoverage Status CI Try on RunKit npm version

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

Licence

Code is MIT

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

changelog

1.3.0 (2021-04-15)

Features

  • Rebuild: Recreate fixtures (6e4cc87)

1.2.0 (2020-10-12)

Features

  • Rebuild: Updates for rooftop geos and uprn (56b29fc)

1.1.0 (2020-05-20)

Features

  • Address: Add country specific address fixtures (14bff6e)

1.0.0 (2020-04-17)

Tests

  • Deps: Upgrade X dependency (040be2f)

BREAKING CHANGES

  • Deps: Drop support for node 8

0.1.0 (2019-06-04)

Features

  • Fixture Generation: New run on 2019-06-04 (620a140)
  • Keys: Add definitions (38f1f8e)
  • Semantic Release: Add automated semantic releases (3d66131)

0.0.4 (25/03/2019)

  • Updated documentation
  • Add timestamp for each test run
  • Add runkit demo
  • Restructure test directory

0.0.3 (12/02/2019)

  • Fix: Pass Multiple Residence key to Multiple Residence address query

0.0.2 (31/01/2019)

  • Initial release