[Pkg-javascript-commits] [node-mocks-http] 165/296: added; tests for mockEventEmitter

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

alteholz pushed a commit to branch master
in repository node-mocks-http.

commit 25e90037ecde8b35e89b771081a20731a12f557c
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date:   Mon Apr 6 15:05:55 2015 +0800

    added; tests for mockEventEmitter
---
 test/lib/mockEventEmitter.spec.js | 61 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/test/lib/mockEventEmitter.spec.js b/test/lib/mockEventEmitter.spec.js
new file mode 100644
index 0000000..c113474
--- /dev/null
+++ b/test/lib/mockEventEmitter.spec.js
@@ -0,0 +1,61 @@
+'use strict';
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var MockEventEmitter = require('../../lib/mockEventEmitter');
+var mockEventEmitter;
+
+describe('mockEventEmitter', function() {
+
+  before(function() {
+    mockEventEmitter = new MockEventEmitter();
+  });
+
+  it('should be a function', function() {
+    expect(MockEventEmitter).to.be.a('function');
+  });
+
+  it('should be an object factory', function() {
+    expect(mockEventEmitter).to.be.a('object');
+    expect(mockEventEmitter).to.be.an.instanceof(MockEventEmitter);
+  });
+
+  it('should expose "MockEventEmitter" prototype', function() {
+    expect(mockEventEmitter).to.have.property('addListener');
+    expect(mockEventEmitter.addListener).to.be.a('function');
+
+    expect(mockEventEmitter).to.have.property('on');
+    expect(mockEventEmitter.on).to.be.a('function');
+
+    expect(mockEventEmitter).to.have.property('once');
+    expect(mockEventEmitter.once).to.be.a('function');
+
+    expect(mockEventEmitter).to.have.property('removeListener');
+    expect(mockEventEmitter.removeListener).to.be.a('function');
+
+    expect(mockEventEmitter).to.have.property('removeAllListeners');
+    expect(mockEventEmitter.removeAllListeners).to.be.a('function');
+
+    expect(mockEventEmitter).to.have.property('setMaxListeners');
+    expect(mockEventEmitter.setMaxListeners).to.be.a('function');
+
+    expect(mockEventEmitter).to.have.property('listeners');
+    expect(mockEventEmitter.listeners).to.be.a('function');
+
+    expect(mockEventEmitter).to.have.property('emit');
+    expect(mockEventEmitter.emit).to.be.a('function');
+  });
+
+  it('should return undefined when methods called', function() {
+    expect(mockEventEmitter.addListener()).to.be.undefined;
+    expect(mockEventEmitter.on()).to.be.undefined;
+    expect(mockEventEmitter.once()).to.be.undefined;
+    expect(mockEventEmitter.removeListener()).to.be.undefined;
+    expect(mockEventEmitter.removeAllListeners()).to.be.undefined;
+    expect(mockEventEmitter.setMaxListeners()).to.be.undefined;
+    expect(mockEventEmitter.listeners()).to.be.undefined;
+    expect(mockEventEmitter.emit()).to.be.undefined;
+  });
+
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git



More information about the Pkg-javascript-commits mailing list