Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1a4930f

Browse files
committed
add test for configurableSortingArray
1 parent e139378 commit 1a4930f

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

src/test/suite/usesFormatter.test.ts

+26-4
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,52 @@ import { formatText, ITextSection } from '../../usesFormatter';
33
var expect = require('chai').expect;
44
var {describe, it} = require('mocha');
55

6+
interface ITestInput {
7+
text: string;
8+
configurableSortingArray: string[];
9+
}
10+
611
interface TestSample {
7-
input: string;
12+
input: ITestInput;
813
output: ITextSection[];
914
}
1015

1116
const sampleTexts: TestSample[] = [
1217
{
13-
input: "uses d, c, b, e, f, a;",
18+
input: {
19+
text: "uses d, c, b, e, f, a;",
20+
configurableSortingArray: []
21+
},
1422
output: [
1523
{
1624
startOffset: 0,
1725
endOffset:22,
1826
value: "uses\n a,\n b,\n c,\n d,\n e,\n f;"
1927
}
2028
],
21-
}
29+
},
30+
{
31+
input: {
32+
text: "uses d, c, b, e, f, a;",
33+
configurableSortingArray: ["c", "f"]
34+
},
35+
output: [
36+
{
37+
startOffset: 0,
38+
endOffset:22,
39+
value: "uses\n c,\n f,\n a,\n b,\n d,\n e;"
40+
}
41+
],
42+
},
43+
2244
];
2345

2446
const test = (sample: TestSample): void =>
2547
{
2648
const separator = " ";
2749
const lineEnd = "\n";
2850

29-
const replaces = formatText(sample.input, separator, lineEnd, []);
51+
const replaces = formatText(sample.input.text, separator, lineEnd, sample.input.configurableSortingArray);
3052
expect(replaces).to.eql(sample.output);
3153
};
3254

0 commit comments

Comments
 (0)