1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/unleash-server/test/apiSpec.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2014-10-20 15:12:30 +02:00
var request = require('supertest');
request = request('http://localhost:4242');
describe('The api', function () {
var server;
before(function () {
server = require('../server');
});
after(function () {
server.server.close();
});
it('returns three mocked feature toggles', function (done) {
request
.get('/features')
.expect(200, done);
});
it('creates new feature toggle', function (done) {
request
.post('/features')
2014-10-21 16:02:23 +02:00
.send({name: 'com.test.feature', 'status': 'off'})
2014-10-20 15:12:30 +02:00
.set('Content-Type', 'application/json')
.expect(201, done);
});
2014-10-21 16:02:23 +02:00
it('change status of feature toggle', function (done) {
request
.patch('/features/com.test.feature')
.send({
'comment': 'patch test of com.test.feature',
data: {
'status': 'on'
}
})
.set('Content-Type', 'application/json')
.expect(204, done);
});
2014-10-20 15:12:30 +02:00
});