From 9e92228f1aed9bd32a6a18918a30668b6687f444 Mon Sep 17 00:00:00 2001 From: andsandv Date: Wed, 22 Oct 2014 16:26:36 +0200 Subject: [PATCH] Rename eventRepository to eventStore --- unleash-server/lib/api.js | 5 ++--- .../lib/{eventRepository.js => eventStore.js} | 10 ++++------ .../test/{eventRepositorySpec.js => eventStoreSpec.js} | 9 ++++----- 3 files changed, 10 insertions(+), 14 deletions(-) rename unleash-server/lib/{eventRepository.js => eventStore.js} (54%) rename unleash-server/test/{eventRepositorySpec.js => eventStoreSpec.js} (65%) diff --git a/unleash-server/lib/api.js b/unleash-server/lib/api.js index 6c780341a0..6edfd4edb6 100644 --- a/unleash-server/lib/api.js +++ b/unleash-server/lib/api.js @@ -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}); }); diff --git a/unleash-server/lib/eventRepository.js b/unleash-server/lib/eventStore.js similarity index 54% rename from unleash-server/lib/eventRepository.js rename to unleash-server/lib/eventStore.js index d69b46ec29..6e8ca3087e 100644 --- a/unleash-server/lib/eventRepository.js +++ b/unleash-server/lib/eventStore.js @@ -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(); \ No newline at end of file diff --git a/unleash-server/test/eventRepositorySpec.js b/unleash-server/test/eventStoreSpec.js similarity index 65% rename from unleash-server/test/eventRepositorySpec.js rename to unleash-server/test/eventStoreSpec.js index 6f0ded52fa..35172b6894 100644 --- a/unleash-server/test/eventRepositorySpec.js +++ b/unleash-server/test/eventStoreSpec.js @@ -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',