Skip to content

Commit

Permalink
Add a test for all exposed EventEmitter methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
moll committed Aug 22, 2024
1 parent b4181fb commit f8d5659
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions test/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,15 +728,19 @@ describe("Mitm", function() {
})
})

describe(".prototype.addListener", function() {
it("must be an alias to EventEmitter.prototype.addListener", function() {
Mitm.prototype.addListener.must.equal(EventEmitter.prototype.addListener)
})
})

describe(".prototype.off", function() {
it("must be an alias to EventEmitter.prototype.removeListener", function() {
Mitm.prototype.off.must.equal(EventEmitter.prototype.removeListener)
_.each({
on: EventEmitter.prototype.on,
once: EventEmitter.prototype.once,
off: EventEmitter.prototype.removeListener,
addListener: EventEmitter.prototype.addListener,
removeListener: EventEmitter.prototype.removeListener,
emit: EventEmitter.prototype.emit
}, function(to, from) {
describe(".prototype." + from, function() {
it("must be an alias to EventEmitter.prototype", function() {
Mitm.prototype.must.have.property(from, to)
Mitm.prototype[from].must.be.a.function()
})
})
})
})
Expand Down

0 comments on commit f8d5659

Please sign in to comment.