2020-12-07 05:19:02 +01:00
|
|
|
import { isArgFormatInvalid } from './helpers';
|
2020-12-06 18:34:32 +01:00
|
|
|
|
2020-12-07 05:19:02 +01:00
|
|
|
describe('isArgFormatInvalid', () => {
|
|
|
|
test('is false for correct short args', () => {
|
|
|
|
expect(isArgFormatInvalid('-t')).toBe(false);
|
2020-12-06 18:34:32 +01:00
|
|
|
});
|
|
|
|
|
2020-12-07 05:19:02 +01:00
|
|
|
test('is true for improperly double-dashed short args', () => {
|
|
|
|
expect(isArgFormatInvalid('--t')).toBe(true);
|
2020-12-06 18:34:32 +01:00
|
|
|
});
|
|
|
|
|
2020-12-07 22:50:59 +01:00
|
|
|
test('is false for --x and --y (backwards compat, we should have made these short, oh well)', () => {
|
|
|
|
expect(isArgFormatInvalid('--x')).toBe(false);
|
|
|
|
expect(isArgFormatInvalid('--y')).toBe(false);
|
|
|
|
});
|
|
|
|
|
2020-12-07 05:19:02 +01:00
|
|
|
test('is false for correct long args', () => {
|
|
|
|
expect(isArgFormatInvalid('--test')).toBe(false);
|
2020-12-06 18:34:32 +01:00
|
|
|
});
|
|
|
|
|
2020-12-07 05:19:02 +01:00
|
|
|
test('is true for improperly triple-dashed long args', () => {
|
|
|
|
expect(isArgFormatInvalid('---test')).toBe(true);
|
2020-12-06 18:34:32 +01:00
|
|
|
});
|
|
|
|
|
2020-12-07 05:19:02 +01:00
|
|
|
test('is true for improperly single-dashed long args', () => {
|
|
|
|
expect(isArgFormatInvalid('-test')).toBe(true);
|
2020-12-06 18:34:32 +01:00
|
|
|
});
|
|
|
|
|
2020-12-07 05:19:02 +01:00
|
|
|
test('is false for correct long args with dashes', () => {
|
|
|
|
expect(isArgFormatInvalid('--test-run')).toBe(false);
|
2020-12-06 18:34:32 +01:00
|
|
|
});
|
|
|
|
|
2020-12-07 05:19:02 +01:00
|
|
|
test('is false for correct long args with many dashes', () => {
|
|
|
|
expect(isArgFormatInvalid('--test-run-with-many-dashes')).toBe(false);
|
2020-12-06 18:34:32 +01:00
|
|
|
});
|
|
|
|
});
|