Papupata Documentation

API Reference

module supertestAdapter

Default export createSupertestAdapter

Purpose

This module allows you to use supertest to make papupata API requests.

Availability

This functionality is available from papupata version 1.5.0 onwards.

Usage

import createSupertestAdapter from 'papupata/adapters/supertest'

To begin with, you'll want to set up a supertest request for your express application. Once done, you can create a supertest papupata adapter to start making API calls.

Do note that you'll almost certainly want to configure papupata with a blank base URL to make things work.

Parameters

NameTypeDescription
supertestRequestSupertest requestSupertest request

Returns

Papupata MakeRequestAdapter

Examples

import { APIDeclaration } from 'papupata'
import createSupertestAdapter from 'papupata/adapters/supertest'
import express from 'express'
import supertest from 'supertest'

const app = express()
const request = supertest(app)
const API = new APIDeclaration()
API.configure({
  app,
  baseURL: '',
  requestAdapter: createSupertestAdapter(request)
})