Skip to content

Commit 97c06aa

Browse files
authored
Merge ArgumentsHelper unit tests into one file (microsoft#6584)
* Merge tests * Add news file
1 parent f2c1a57 commit 97c06aa

File tree

3 files changed

+18
-68
lines changed

3 files changed

+18
-68
lines changed

news/3 Code Health/6583.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Merge ArgumentsHelper unit tests into one file.

src/test/common/argumentsHelper.unit.test.ts

Lines changed: 0 additions & 66 deletions
This file was deleted.

src/test/testing/common/argsHelper.unit.test.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ suite('Unit Tests - Arguments Helper', () => {
6666
expect(values).to.be.lengthOf(2);
6767
expect(values).to.be.deep.equal(['value2', 'value3']);
6868
});
69-
test('Get multiple Positional options and ineline values', () => {
69+
test('Get multiple Positional options and inline values', () => {
7070
const args = ['-abc=1234', '--value-option=value1', '--no-value-option', 'value2', 'value3'];
7171
const values = argsHelper.getPositionalArguments(args, ['--value-option', '-abc'], ['--no-value-option']);
7272
expect(values).to.be.array();
@@ -80,13 +80,28 @@ suite('Unit Tests - Arguments Helper', () => {
8080
expect(values).to.be.lengthOf(1);
8181
expect(values).to.be.deep.equal(['value3']);
8282
});
83-
test('Get multiplle Positional options with trailing value option', () => {
83+
test('Get multiple Positional options with trailing value option', () => {
8484
const args = ['-abc', '1234', '--value-option', 'value1', '--value-option', 'value2', 'value3', '4'];
8585
const values = argsHelper.getPositionalArguments(args, ['--value-option', '-abc'], ['--no-value-option']);
8686
expect(values).to.be.array();
8787
expect(values).to.be.lengthOf(2);
8888
expect(values).to.be.deep.equal(['value3', '4']);
8989
});
90+
test('Get Positional options with unknown args', () => {
91+
const args = ['-abc', '1234', '--value-option', 'value1', '--value-option', 'value2', 'value3', '4'];
92+
const values = argsHelper.getPositionalArguments(args, ['-abc'], ['--no-value-option']);
93+
expect(values).to.be.array();
94+
expect(values).to.be.lengthOf(4);
95+
expect(values).to.be.deep.equal(['value1', 'value2', 'value3', '4']);
96+
});
97+
test('Get Positional options with no options parameters', () => {
98+
const args = ['-abc', '1234', '--value-option', 'value1', '--value-option', 'value2', 'value3', '4'];
99+
const values = argsHelper.getPositionalArguments(args);
100+
expect(values).to.be.array();
101+
expect(values).to.be.lengthOf(5);
102+
expect(values).to.be.deep.equal(['1234', 'value1', 'value2', 'value3', '4']);
103+
expect(values).to.be.deep.equal(argsHelper.getPositionalArguments(args, [], []));
104+
});
90105
test('Filter to remove those with values', () => {
91106
const args = ['-abc', '1234', '--value-option', 'value1', '--value-option', 'value2', 'value3', '4'];
92107
const values = argsHelper.filterArguments(args, ['--value-option']);

0 commit comments

Comments
 (0)