Skip to content

Commit 12fadef

Browse files
committed
test(MongoInstance): add test for code 0 and code 12 for windows
1 parent 0668c35 commit 12fadef

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

packages/mongodb-memory-server-core/src/util/__tests__/MongoInstance.test.ts

+24
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,30 @@ describe('MongodbInstance', () => {
390390
}
391391
});
392392

393+
it('should not emit "instanceError" with 0 or 12 exit code on windows', () => {
394+
Object.defineProperty(process, 'platform', {
395+
value: 'win32',
396+
});
397+
398+
// test code 0
399+
{
400+
events.clear();
401+
mongod.closeHandler(0, null);
402+
403+
expect(events.size).toEqual(1);
404+
expect(events.get(MongoInstanceEvents.instanceClosed)).toEqual([0, null]);
405+
}
406+
407+
// test code 12
408+
{
409+
events.clear();
410+
mongod.closeHandler(12, null);
411+
412+
expect(events.size).toEqual(1);
413+
expect(events.get(MongoInstanceEvents.instanceClosed)).toEqual([12, null]);
414+
}
415+
});
416+
393417
it('"closeHandler" should emit "instanceError" with vc_redist helper message on windows on high exit code', () => {
394418
events.clear();
395419
Object.defineProperty(process, 'platform', {

0 commit comments

Comments
 (0)