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

Rename eventRepository to eventStore

This commit is contained in:
andsandv 2014-10-22 16:26:36 +02:00
parent 8c643d4e8c
commit 9e92228f1a
3 changed files with 10 additions and 14 deletions

View File

@ -1,12 +1,11 @@
var db = require('./db'); var db = require('./db');
var EventRepository = require('./eventRepository'); var eventStore = require('./eventStore');
var eventDb = new EventRepository();
module.exports = function (app) { module.exports = function (app) {
app.get('/features', function (req, res) { app.get('/features', function (req, res) {
// TODO svelovla, fix this // TODO svelovla, fix this
eventDb.create({name: 'testing method'}); eventStore.create({name: 'testing method'});
db.getFeatures().then(function (features) { db.getFeatures().then(function (features) {
res.json({features: features}); res.json({features: features});
}); });

View File

@ -2,16 +2,14 @@ var util = require('util');
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
var events = require('./events'); var events = require('./events');
function EventRepository() { function EventStore() {
EventEmitter.call(this); EventEmitter.call(this);
} }
util.inherits(EventRepository, EventEmitter); util.inherits(EventStore, EventEmitter);
EventRepository.prototype.create = function (obj) { EventStore.prototype.create = function (obj) {
this.emit(events.featureCreated, obj); this.emit(events.featureCreated, obj);
}; };
module.exports = new EventStore();
module.exports = EventRepository;

View File

@ -1,17 +1,16 @@
var assert = require('assert'); var assert = require('assert');
var events = require('../lib/events'); var events = require('../lib/events');
var EventRepository = require('../lib/eventRepository'); var eventStore = require('../lib/eventStore');
var eventRepository = new EventRepository();
describe('EventRepository', function () { describe('EventStore', function () {
describe('#create()', function () { describe('#create()', function () {
it('should emit event', function (done) { it('should emit event', function (done) {
eventRepository.on(events.featureCreated, function (x) { eventStore.on(events.featureCreated, function (x) {
assert(x); assert(x);
done(); done();
} }
); );
eventRepository.create({ eventStore.create({
'name': 'mail-server.validate-email-addresses', 'name': 'mail-server.validate-email-addresses',
'enabled': false, 'enabled': false,
'strategy': 'default', 'strategy': 'default',