Initial promotion search test

This commit is contained in:
Fergal Moran
2014-03-21 19:11:47 +00:00
parent f4f0293c7d
commit 7ccc745eb7
2 changed files with 26 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ module.exports = function(app) {
// Server API Routes
app.get('/api/awesomeThings', api.awesomeThings);
app.get('/api/promotions', promotions.list);
app.post('/api/promotions', promotions.create);
app.post('/api/users', users.create);
app.put('/api/users', users.changePassword);

View File

@@ -1,19 +1,31 @@
'use strict';
var should = require('should'),
app = require('../../../server'),
request = require('supertest');
app = require('../../../server'),
request = require('supertest');
describe('GET /api/promotions', function() {
it('should respond with JSON array', function(done) {
request(app)
.get('/api/promotions')
.expect(200)
.expect('Content-Type', /json/)
.end(function(err, res) {
if (err) return done(err);
res.body.should.be.instanceof(Array);
done();
});
});
it('should respond with JSON array', function(done) {
request(app)
.get('/api/promotions')
.expect(200)
.expect('Content-Type', /json/)
.end(function(err, res) {
if (err) return done(err);
res.body.should.be.instanceof(Array);
done();
});
});
});
describe('POST /api/promotions', function(){
it('should respond with the item POSTed', function(done){
request(app)
.post('/api/promotions')
.send({
title: 'API - Test 2',
user: {
name: 'Fergal Moran'
}
});
});
});