JSPM

@sheetbase/testing

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q28348F
  • License MIT

Tools for testing Sheetbase backend.

Package Exports

  • @sheetbase/testing

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sheetbase/testing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sheetbase Testing

Tools for testing Sheetbase backend.

Install

npm install --save-dev @sheetbase/testing

Usage

// import testing browser
import { Browser } from '@sheetbase/testing';

// import app instance
import * as App from '../src/index';

// init a browser instance for the app
const browser = new Browser(App);

// begin test
describe('Home routes', () => {

    it('GET /', () => {
        const { body } = browser.get('/');
        expect(body).to.contain('Sheetbase Backend');
    });

    it('POST /', () => {
        const { body } = browser.post('/');
        expect(body.data).to.eql({ title: 'Sheetbase Backend' });
    });

});

API

const browser = new Browser(App);

// GET /
const { body } = browser.get('/', { /* params */ });

// POST /xxx
const { body } = browser.post('/xxx', { /* params */ }, { /* body */ });

// PUT /
const { body } = browser.put('/', { /* params */ }, { /* body */ });

// PATCH /
const { body } = browser.patch('/', { /* params */ }, { /* body */ });

// DELETE /
const { body } = browser.delete('/', { /* params */ }, { /* body */ });

License

This package is released under the MIT license.