Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions test/api/main.test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,47 @@
import { expect } from 'chai'
import supertest from 'supertest'
import server from '../../src/index'

describe('Main API routes', () => {
let api
let path

beforeEach(() => {
api = supertest(server)
})

describe('GET /version', () => {
let path
describe('GET /', () => {
// this beforeEach is needed as SuperAgent doesn't like .end() called more than once
beforeEach(() => {
path = api.get('/')
})

xit('responds with available routes', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably not going to happen as we are going to have an Api Spec for describing the API.

// TODO: figure out how to deal with SuperAgent
})

it('responds with json', () => {
return path.expect('Content-Type', /json/)
})
})

describe('GET /name', () => {
// this beforeEach is needed as SuperAgent doesn't like .end() called more than once
beforeEach(() => {
path = api.get('/name')
})

it('responds with package name', () => {
return path.expect(200, {
name: process.env.npm_package_name
})
})

it('responds with json', () => {
return path.expect('Content-Type', /json/)
})
})

describe('GET /version', () => {
// this beforeEach is needed as SuperAgent doesn't like .end() called more than once
beforeEach(() => {
path = api.get('/version')
Expand Down