'use strict';

const PointsService = require('../../services/points');
const test = require('../../test-helpers/fresh');
const { get, post } = require('../../test-helpers/http');

test('GET /points returns an empty list if none exist', (t) => {
  return get('/points')
    .then(([response, body]) => {
      t.equal(response.status, 200, 'status=200');
      t.deepEqual(body, []);
    });
});

test('GET /points returns an array of points', (t) => {
  let point;

  return PointsService.create('Name', 'Description').then((_point) => {
    point = _point;

    return get('/points');
  }).then(([response, body]) => {
    t.equal(response.status, 200, 'status=200');
    t.deepEqual(body, [point]);
  });
});

test('POST /points returns a 400 if required data is missing', (t) => {
  return post('/points', { body: {} })
    .then(([response]) => {
      t.equal(response.status, 400);
    });
});

test('POST /points returns new point data', (t) => {
  return post('/points', {
    body: { title: 'Great Point', description: 'Yes' }
  }).then(([response, body]) => {
    t.equal(response.status, 201);
    t.equal(body.title, 'Great Point');
    t.equal(body.description, 'Yes');
  });
});

@@ -691,19 +691,38 @@
  %5Bpoint%5D
+, 'body is correct'
 );%0A
-
   %7D);%0A%7D)
@@ -897,16 +897,30 @@
 tus, 400
+, 'status=400'
 );%0A    %7D
@@ -1088,32 +1088,32 @@
 se, body%5D) =%3E %7B%0A
-
     t.equal(resp
@@ -1128,16 +1128,30 @@
 tus, 201
+, 'status=201'
 );%0A    t

Add additional assertion messages