@infctr/eslint-docs
Version:
Keep your rule names and descriptions up-to-date across your repo
44 lines (43 loc) • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const flags_1 = require("./flags");
const checkArgs = args => expect(flags_1.parse(args)).toMatchSnapshot();
const dropArgs = parsed => {
delete parsed.args;
return parsed;
};
describe('parse()', () => {
it('returns the full object', () => {
checkArgs([]);
});
it('supports `check`', () => {
checkArgs(['check']);
});
it('supports --ext .foo', () => {
checkArgs(['--ext', '.ts']);
});
it('supports --ext=.foo', () => {
checkArgs(['--ext=.ts']);
});
it('supports --ext foo', () => {
checkArgs(['--ext', 'ts']);
});
it('supports --ext=foo', () => {
checkArgs(['--ext=ts']);
});
it('supports both --ext and check', () => {
checkArgs(['--ext', 'js', 'check']);
expect(dropArgs(flags_1.parse(['--ext', 'js', 'check']))).toEqual(dropArgs(flags_1.parse(['check', '--ext', 'js'])));
});
it('supports both --ext=foo and check', () => {
checkArgs(['--ext=js', 'check']);
expect(dropArgs(flags_1.parse(['--ext=js', 'check']))).toEqual(dropArgs(flags_1.parse(['check', '--ext=js'])));
});
it('ignores --ext at the end of the args', () => {
checkArgs(['--ext']);
checkArgs(['check', '--ext']);
});
it('supports --no-diffs', () => {
checkArgs(['--no-diffs']);
});
});