1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00

#18 feature-update event example

This commit is contained in:
svelovla 2014-10-21 16:02:23 +02:00 committed by Ivar Conradi Østhus
parent dc54d8504a
commit b575f646eb
2 changed files with 29 additions and 2 deletions

View File

@ -34,7 +34,20 @@ module.exports = function (app) {
});
app.patch('/features/:id', function (req, res) {
res.status(500).end();
var body = req.body;
body.data.name = req.params.id;
var event = {};
event.type = 'feature-update';
event.user = req.connection.remoteAddress;
event.comment = body.comment;
event.data = body.data;
// console.log(event);
// db.save(event).then(function () {
res.status(204).end();
// });
});
};

View File

@ -22,8 +22,22 @@ describe('The api', function () {
it('creates new feature toggle', function (done) {
request
.post('/features')
.send({name: 'featureAss', 'status': 'off'})
.send({name: 'com.test.feature', 'status': 'off'})
.set('Content-Type', 'application/json')
.expect(201, done);
});
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);
});
});