const moduleName = 'Bootstrap';
enum exitCodes {
+ succeeded = 0,
missingChargingStationsConfiguration = 1,
noChargingStationTemplates = 2,
+ gracefulShutdownError = 3,
}
export class Bootstrap extends EventEmitter {
console.info(`${chalk.green('Graceful shutdown')}`);
this.stop()
.then(() => {
- process.exit(0);
+ process.exit(exitCodes.succeeded);
})
.catch((error) => {
console.error(chalk.red('Error while shutdowning charging stations simulator: '), error);
- process.exit(1);
+ process.exit(exitCodes.gracefulShutdownError);
});
};
});
it('Verify min()', () => {
+ expect(min()).toBe(Infinity);
expect(min(0, 1)).toBe(0);
expect(min(1, 0)).toBe(0);
expect(min(0, -1)).toBe(-1);
});
it('Verify max()', () => {
+ expect(max()).toBe(-Infinity);
expect(max(0, 1)).toBe(1);
expect(max(1, 0)).toBe(1);
expect(max(0, -1)).toBe(0);