ping.js 476 B

12345678910111213141516171819
  1. 'use strict'
  2. import test from 'ava'
  3. import request from 'supertest'
  4. import { apiPrefix } from '../../../config'
  5. import { json, getHttpServer } from '../../utils/_test_functions'
  6. // ROUTE /ping
  7. // Before each tests, start a server
  8. test.beforeEach(async t => (t.context.server = await getHttpServer()))
  9. test('GET /ping', async t => {
  10. const res = await request(t.context.server)
  11. .get(`${apiPrefix}/ping`)
  12. t.is(res.status, 200, json(res))
  13. t.is(res.text, 'pong')
  14. })