diff --git a/test/event/EventableTestConform.js b/test/event/EventableTestConform.js index b3eb44e..4e699c9 100644 --- a/test/event/EventableTestConform.js +++ b/test/event/EventableTestConform.js @@ -18,8 +18,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * A conforming implementation must pass each of these tests. See the - * Eventable interface itself for additional requirements and documentation. + * A conforming implementation must pass each of these tests, but passing + * does not imply a conforming implementation; see the Eventable interface + * itself for additional requirements and documentation. * * To use these tests, invoke the exported function with a constructor * function returning an instance of the SUT. @@ -85,6 +86,11 @@ module.exports = ctor => }; +/** +* Note that by using _fvoid, we are implicitly testing the requirement +* that the listener shall not be required to declare any number of +* parameters (because we defined no parameters). +*/ function _commonTests( ctor, method ) { /** @@ -165,20 +171,30 @@ function _commonTests( ctor, method ) function _onTests( ctor, on ) { - /** - * Note that by using _fvoid, we are implicitly testing the requirement - * that the listener shall not be required to declare any number of - * parameters (because we defined no parameters). - */ - describe( `#${on}`, () => - { - _commonTests( ctor, on ); - } ); + describe( `#${on}`, () => _commonTests( ctor, on ) ); } function _rmTests( ctor ) { _commonTests( ctor, 'removeListener' ); + + /** + * Consider the goal of this operation: to ensure that the provided + * listener will not be invoked upon subsequent message dispatches to + * the provided event. It therefore stands to reason that, if the + * listener was not attached to begin with, that the job has been done, + * and therefore no error should be thrown. + */ + it( 'does not throw error when unhooking non-registered listener', () => + { + let inst = ctor(); + + expect( + inst + .on( _ev, _fvoid ) + .removeListener( _ev, ()=>{} ) ) + .to.equal( inst ); + } ); }