mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
Rename eventRepository to eventStore
This commit is contained in:
parent
f4fd92d254
commit
3dd35fcf71
@ -1,12 +1,11 @@
|
||||
var db = require('./db');
|
||||
var EventRepository = require('./eventRepository');
|
||||
var eventDb = new EventRepository();
|
||||
var eventStore = require('./eventStore');
|
||||
|
||||
module.exports = function (app) {
|
||||
|
||||
app.get('/features', function (req, res) {
|
||||
// TODO svelovla, fix this
|
||||
eventDb.create({name: 'testing method'});
|
||||
eventStore.create({name: 'testing method'});
|
||||
db.getFeatures().then(function (features) {
|
||||
res.json({features: features});
|
||||
});
|
||||
|
@ -2,16 +2,14 @@ var util = require('util');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var events = require('./events');
|
||||
|
||||
function EventRepository() {
|
||||
function EventStore() {
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
module.exports = EventRepository;
|
||||
module.exports = new EventStore();
|
@ -1,17 +1,16 @@
|
||||
var assert = require('assert');
|
||||
var events = require('../lib/events');
|
||||
var EventRepository = require('../lib/eventRepository');
|
||||
var eventRepository = new EventRepository();
|
||||
var eventStore = require('../lib/eventStore');
|
||||
|
||||
describe('EventRepository', function () {
|
||||
describe('EventStore', function () {
|
||||
describe('#create()', function () {
|
||||
it('should emit event', function (done) {
|
||||
eventRepository.on(events.featureCreated, function (x) {
|
||||
eventStore.on(events.featureCreated, function (x) {
|
||||
assert(x);
|
||||
done();
|
||||
}
|
||||
);
|
||||
eventRepository.create({
|
||||
eventStore.create({
|
||||
'name': 'mail-server.validate-email-addresses',
|
||||
'enabled': false,
|
||||
'strategy': 'default',
|
Loading…
Reference in New Issue
Block a user