slettest

a wrapper with supertest

Usage no npm install needed!

<script type="module">
  import slettest from 'https://cdn.skypack.dev/slettest';
</script>

README

slettest

sletjs with supertest for ava or mocha

NPM version Build codecov.io js-standard-style

Usages

var slettest = require('slettest')
var app = require('./app')

test.cb("slettest()", t => {
  slettest(app)
    .get("/")
    .expect(200, function (err, res) {
      t.ifError(err)
      var userId = res.body.id;
      t.is(res.text, 'Hello Koa', 'res.text == Hello Koa')
      t.end()
    });
});

with generator

test('yield slettest()', function * (t) {
  let res = yield slettest(app)
    .get('/')

  t.is(200, res.status)
  t.is(res.text, 'Hello Koa', 'res.text == Hello Koa')
})

with async/await

test('async slettest()', async (t) => {
  let res = await slettest(app)
    .get('/')

  t.is(200, res.status)
  t.is(res.text, 'Hello Koa', 'res.text == Hello Koa')
})

Test

$ npm test

with watch mode

npm test -- -w 

Document

see http://visionmedia.github.io/superagent/