2020-08-28 23:51:46 +00:00
|
|
|
import { expect } from 'chai';
|
|
|
|
import { stub } from 'sinon';
|
|
|
|
|
|
|
|
import { Commands, createParser } from '../../src/config/args';
|
|
|
|
|
|
|
|
describe('args', () => {
|
|
|
|
it('should set command mode', () => {
|
|
|
|
const modeStub = stub();
|
|
|
|
const parser = createParser(modeStub);
|
|
|
|
|
|
|
|
for (const command of [
|
|
|
|
Commands.GRAPH,
|
|
|
|
Commands.ISSUES,
|
|
|
|
Commands.LABELS,
|
|
|
|
]) {
|
2020-08-29 00:16:05 +00:00
|
|
|
const args = parser.parse([command, '--config', 'foo.yml']);
|
2020-08-28 23:51:46 +00:00
|
|
|
expect(args).to.deep.include({
|
|
|
|
dryrun: true,
|
|
|
|
});
|
|
|
|
expect(modeStub).to.have.been.calledWith(command);
|
|
|
|
modeStub.resetHistory();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|