0.6.5 • Published 2 years ago

@mhio/taxios v0.6.5

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

taxios

Testing made easier with axios. If your app can inject a pino logger, mocha can dump more app context on errors.

const { App } = require('../lib/App')
const { Taxios } = require('taxios')

describe('test the app', function(){

  let request

  beforeEach(async function(){
    const logger = Taxios.logger()
    const app = await App.setup({ logger })
    request = await Taxios.app(app, logger)
  })

  afterEach(async function(){
    // Get some error context from your app, if it uses the logger
    request.handleMochaError(this)
    // Close down the server
    await request.cleanUp()
  })

  // Or both steps in one
  afterEach(async function(){
    await request.afterMocha(this)
  })

  it('should request from the app for great success', async function(){
    const res = request.send('get', '/whatever', {}, { headers: { type: 'yeet' } })
    expect( res.data ).to.containSubset({
      yote: true
    })
  })

})
0.6.3

2 years ago

0.6.2

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.0

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

4 years ago

0.1.0

4 years ago

0.1.0-2

4 years ago