@sheetbase/testing
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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.

Package Sidebar

Install

npm i @sheetbase/testing

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

11.1 kB

Total Files

13

Last publish

Collaborators

  • lamnhan