fix tests to include mode in args
This commit is contained in:
parent
24d96a56d4
commit
2ba2baceb6
|
@ -20,7 +20,6 @@ export interface ParsedArgs {
|
||||||
export function parseArgs(args: Array<string>): ParsedArgs {
|
export function parseArgs(args: Array<string>): ParsedArgs {
|
||||||
let mode = Commands.UNKNOWN;
|
let mode = Commands.UNKNOWN;
|
||||||
|
|
||||||
/* eslint-disable-next-line sonarjs/prefer-immediate-return */
|
|
||||||
const parser = yargs(args)
|
const parser = yargs(args)
|
||||||
.usage(`Usage: ${VERSION_INFO.package.name} <mode> [options]`)
|
.usage(`Usage: ${VERSION_INFO.package.name} <mode> [options]`)
|
||||||
.scriptName(VERSION_INFO.package.name)
|
.scriptName(VERSION_INFO.package.name)
|
||||||
|
|
|
@ -34,9 +34,9 @@ describe('main app', () => {
|
||||||
const args: ParsedArgs = {
|
const args: ParsedArgs = {
|
||||||
config: '',
|
config: '',
|
||||||
dryrun: true,
|
dryrun: true,
|
||||||
|
mode: Commands.GRAPH,
|
||||||
};
|
};
|
||||||
const logger = NullLogger.global;
|
const logger = NullLogger.global;
|
||||||
const mode = Commands.GRAPH;
|
|
||||||
|
|
||||||
const remote = createStubInstance(GithubRemote);
|
const remote = createStubInstance(GithubRemote);
|
||||||
remote.connect.returns(Promise.resolve(true));
|
remote.connect.returns(Promise.resolve(true));
|
||||||
|
@ -47,7 +47,7 @@ describe('main app', () => {
|
||||||
const container = Container.from(module);
|
const container = Container.from(module);
|
||||||
await container.configure();
|
await container.configure();
|
||||||
|
|
||||||
const status = await mainProject(args, container, logger, mode, TEST_PROJECT);
|
const status = await mainProject(args, container, logger, args.mode, TEST_PROJECT);
|
||||||
expect(status).to.equal(STATUS_SUCCESS);
|
expect(status).to.equal(STATUS_SUCCESS);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -55,9 +55,9 @@ describe('main app', () => {
|
||||||
const args: ParsedArgs = {
|
const args: ParsedArgs = {
|
||||||
config: '',
|
config: '',
|
||||||
dryrun: true,
|
dryrun: true,
|
||||||
|
mode: Commands.GRAPH,
|
||||||
};
|
};
|
||||||
const logger = NullLogger.global;
|
const logger = NullLogger.global;
|
||||||
const mode = Commands.GRAPH;
|
|
||||||
|
|
||||||
const remote = createStubInstance(GithubRemote);
|
const remote = createStubInstance(GithubRemote);
|
||||||
remote.connect.returns(Promise.resolve(false));
|
remote.connect.returns(Promise.resolve(false));
|
||||||
|
@ -68,7 +68,7 @@ describe('main app', () => {
|
||||||
const container = Container.from(module);
|
const container = Container.from(module);
|
||||||
await container.configure();
|
await container.configure();
|
||||||
|
|
||||||
const status = await mainProject(args, container, logger, mode, TEST_PROJECT);
|
const status = await mainProject(args, container, logger, args.mode, TEST_PROJECT);
|
||||||
expect(status).to.equal(STATUS_FAILURE);
|
expect(status).to.equal(STATUS_FAILURE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -76,10 +76,10 @@ describe('main app', () => {
|
||||||
const args: ParsedArgs = {
|
const args: ParsedArgs = {
|
||||||
config: '',
|
config: '',
|
||||||
dryrun: true,
|
dryrun: true,
|
||||||
|
mode: Commands.GRAPH,
|
||||||
project: ['foo']
|
project: ['foo']
|
||||||
};
|
};
|
||||||
const logger = NullLogger.global;
|
const logger = NullLogger.global;
|
||||||
const mode = Commands.GRAPH;
|
|
||||||
|
|
||||||
const remote = createStubInstance(GithubRemote);
|
const remote = createStubInstance(GithubRemote);
|
||||||
remote.connect.throws(new NotImplementedError());
|
remote.connect.throws(new NotImplementedError());
|
||||||
|
@ -90,7 +90,7 @@ describe('main app', () => {
|
||||||
const container = Container.from(module);
|
const container = Container.from(module);
|
||||||
await container.configure();
|
await container.configure();
|
||||||
|
|
||||||
const status = await mainProject(args, container, logger, mode, TEST_PROJECT);
|
const status = await mainProject(args, container, logger, args.mode, TEST_PROJECT);
|
||||||
expect(status).to.equal(STATUS_SUCCESS);
|
expect(status).to.equal(STATUS_SUCCESS);
|
||||||
expect(remote.connect).to.have.callCount(0);
|
expect(remote.connect).to.have.callCount(0);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue