hacker-news-cli/tests/integration/sample.js
Robert Webb f5e38cbd70 Added a sample test using supertest, axios, and sinon.
It does not past but I can confirm it does call the api!
2019-02-17 20:20:31 -08:00

25 lines
664 B
JavaScript

const app = require('../../index')
const { expect } = require('chai')
const request = require('supertest')
const axios = require('axios')
const sinon = require('sinon')
describe('Sample Test suite', function() {
let sandbox
beforeEach(() => sandbox = sinon.sandbox.create())
afterEach(() => sandbox.restore())
it('Articlse route should send a page', function(done) {
const resolved = Promise.resolve({ data: [] })
sandbox.stub(axios, 'get').returns({})
request(app)
.get('/articles')
.end(function(err, res) {
expect(res.body.version).to.be.ok
expect(res.statusCode).to.equal(200)
done()
})
})
})