Skip to content

Commit

Permalink
Divides installer test
Browse files Browse the repository at this point in the history
  • Loading branch information
joncloud committed Sep 7, 2020
1 parent aca27a5 commit 89f133c
Showing 1 changed file with 48 additions and 44 deletions.
92 changes: 48 additions & 44 deletions test/installer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,71 +13,75 @@ describe('Installer', () => {
}
});

it('should create installer for install.nsi', () => {
const debugMode = true;
const target = new Installer(debugMode);
describe('createInstaller', () => {
it('should create installer for install.nsi', () => {
const debugMode = true;
const target = new Installer(debugMode);

target.createInstaller(existingScriptPath);
target.createInstaller(existingScriptPath);

const actual = installerExists();
const actual = installerExists();

expect(actual).to.equal(
true,
'Installer `./installsig.exe` should exist'
);
expect(actual).to.equal(
true,
'Installer `./installsig.exe` should exist'
);
});
});

it('should default to no warnings verbosity, given no debug mode', () => {
const debugMode = false;
const target = new Installer(debugMode);
describe('getProcessArguments', () => {
it('should default to no warnings verbosity, given no debug mode', () => {
const debugMode = false;
const target = new Installer(debugMode);

const args = target.getProcessArguments(existingScriptPath);
const args = target.getProcessArguments(existingScriptPath);

expect(args).to.contain('/V1');
});
expect(args).to.contain('/V1');
});

it('should default to all verbosity, given **debug** mode', () => {
const debugMode = true;
const target = new Installer(debugMode);
it('should default to all verbosity, given **debug** mode', () => {
const debugMode = true;
const target = new Installer(debugMode);

const args = target.getProcessArguments(existingScriptPath);
const args = target.getProcessArguments(existingScriptPath);

expect(args).to.contain('/V4');
});
expect(args).to.contain('/V4');
});

it('should not add verbosity, given /V is in arguments', () => {
const debugMode = false;
const target = new Installer(debugMode);
it('should not add verbosity, given /V is in arguments', () => {
const debugMode = false;
const target = new Installer(debugMode);

target.setCustomArguments('/V2');
target.setCustomArguments('/V2');

const args = target.getProcessArguments(existingScriptPath);
const args = target.getProcessArguments(existingScriptPath);

expect(args).to.not.contain('/V1');
expect(args).to.contain('/V2');
});
expect(args).to.not.contain('/V1');
expect(args).to.contain('/V2');
});

it('should not add verbosity, given -V is in arguments', () => {
const debugMode = false;
const target = new Installer(debugMode);
it('should not add verbosity, given -V is in arguments', () => {
const debugMode = false;
const target = new Installer(debugMode);

target.setCustomArguments('-V2');
target.setCustomArguments('-V2');

const args = target.getProcessArguments(existingScriptPath);
const args = target.getProcessArguments(existingScriptPath);

expect(args).to.not.contain('/V1');
expect(args).to.contain('-V2');
});
expect(args).to.not.contain('/V1');
expect(args).to.contain('-V2');
});

it('should resolve and quote script path', () => {
const debugMode = false;
const target = new Installer(debugMode);
it('should resolve and quote script path', () => {
const debugMode = false;
const target = new Installer(debugMode);

target.setCustomArguments('-V2');
target.setCustomArguments('-V2');

const args = target.getProcessArguments(existingScriptPath);
const args = target.getProcessArguments(existingScriptPath);

const actualScriptPath = args[args.length - 1];
expect(actualScriptPath).to.equal(`"${path.resolve(existingScriptPath)}"`);
const actualScriptPath = args[args.length - 1];
expect(actualScriptPath).to.equal(`"${path.resolve(existingScriptPath)}"`);
});
});
});

0 comments on commit 89f133c

Please sign in to comment.