Skip to content

Commit 0a8aa46

Browse files
committed
feat: add more tests to improve coverage
1 parent 0018e7b commit 0a8aa46

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*!
2+
* I'm Queue Software Project
3+
* Copyright (C) 2025 imqueue.com <[email protected]>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* If you want to use this code in a closed source (commercial) project, you can
19+
* purchase a proprietary commercial license. Please contact us at
20+
* <[email protected]> to get commercial licensing options.
21+
*/
22+
import './mocks';
23+
import { expect } from 'chai';
24+
import { EventEmitter as IMQEventEmitter } from '../src';
25+
import { EventEmitter as NodeEventEmitter } from 'events';
26+
27+
// This test ensures the re-exported EventEmitter from IMessageQueue.ts is exercised
28+
// to cover the function counted by nyc/istanbul for that re-export.
29+
describe('IMessageQueue EventEmitter re-export', () => {
30+
it('should re-export Node.js EventEmitter and be usable', () => {
31+
// Ensure it is the same constructor
32+
expect(IMQEventEmitter).to.equal(NodeEventEmitter);
33+
34+
// And it works as expected when instantiated
35+
const ee = new IMQEventEmitter();
36+
let called = 0;
37+
ee.on('ping', () => { called++; });
38+
ee.emit('ping');
39+
expect(called).to.equal(1);
40+
});
41+
});

0 commit comments

Comments
 (0)