mirror of
https://github.com/fergalmoran/roboto-promoto.git
synced 2025-12-22 09:37:37 +00:00
Initial promotion search test
This commit is contained in:
@@ -16,6 +16,7 @@ module.exports = function(app) {
|
|||||||
// Server API Routes
|
// Server API Routes
|
||||||
app.get('/api/awesomeThings', api.awesomeThings);
|
app.get('/api/awesomeThings', api.awesomeThings);
|
||||||
app.get('/api/promotions', promotions.list);
|
app.get('/api/promotions', promotions.list);
|
||||||
|
app.post('/api/promotions', promotions.create);
|
||||||
|
|
||||||
app.post('/api/users', users.create);
|
app.post('/api/users', users.create);
|
||||||
app.put('/api/users', users.changePassword);
|
app.put('/api/users', users.changePassword);
|
||||||
|
|||||||
@@ -1,19 +1,31 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var should = require('should'),
|
var should = require('should'),
|
||||||
app = require('../../../server'),
|
app = require('../../../server'),
|
||||||
request = require('supertest');
|
request = require('supertest');
|
||||||
|
|
||||||
describe('GET /api/promotions', function() {
|
describe('GET /api/promotions', function() {
|
||||||
it('should respond with JSON array', function(done) {
|
it('should respond with JSON array', function(done) {
|
||||||
request(app)
|
request(app)
|
||||||
.get('/api/promotions')
|
.get('/api/promotions')
|
||||||
.expect(200)
|
.expect(200)
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
.end(function(err, res) {
|
.end(function(err, res) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
res.body.should.be.instanceof(Array);
|
res.body.should.be.instanceof(Array);
|
||||||
done();
|
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'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user