diff --git a/test/test.ts b/test/test.ts index d3f3648..453b7b5 100644 --- a/test/test.ts +++ b/test/test.ts @@ -8,4 +8,13 @@ tap.test('should create an instance of smartdaemon', async () => { expect(testSmartdaemon).to.be.instanceOf(smartdaemon.SmartDaemon); }); +tap.test('should create a service', async () => { + testSmartdaemon.addService({ + command: 'npm -v', + description: 'displays the npm version', + name: 'npmversion', + workingDir: __dirname + }); +}); + tap.start(); diff --git a/ts/smartdaemon.classes.smartdaemon.ts b/ts/smartdaemon.classes.smartdaemon.ts index cd8738a..ad58846 100644 --- a/ts/smartdaemon.classes.smartdaemon.ts +++ b/ts/smartdaemon.classes.smartdaemon.ts @@ -33,10 +33,10 @@ export class SmartDaemon { } else { serviceToAdd = existingService; Object.assign(serviceToAdd, optionsArg); - await serviceToAdd.save(); } + await serviceToAdd.save(); return serviceToAdd; - }; + } public async init() { await this.systemdManager.init(); diff --git a/ts/smartdaemon.classes.systemdmanager.ts b/ts/smartdaemon.classes.systemdmanager.ts index 0938772..2c515b2 100644 --- a/ts/smartdaemon.classes.systemdmanager.ts +++ b/ts/smartdaemon.classes.systemdmanager.ts @@ -35,7 +35,7 @@ export class SmartDaemonSystemdManager { if (await this.smartsystem.env.isLinuxAsync()) { this.shouldExecute = true; } else { - console.log('Smartdaemon can only be used on Linuc systems! Refusing to set up a service.'); + console.log('Smartdaemon can only be used on Linux systems! Refusing to set up a service.'); this.shouldExecute = false; } return this.shouldExecute;