Skip to content

Commit 62f3f6e

Browse files
committed
rename testcase
1 parent a3a23fe commit 62f3f6e

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

src/post/__tests__/broadenPeaks.js renamed to src/post/__tests__/broadenPeaks.test.js

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,52 @@
33
var broadenPeaks = require('../broadenPeaks');
44

55
describe('broadenPeaks', () => {
6-
test('should prevent overlap', () => {
6+
it('should prevent overlap', () => {
77
let result = broadenPeaks([
88
{ x: 5, y: 10, width: 5 },
99
{ x: 10, y: 10, width: 5 },
1010
{ x: 30, y: 10, width: 5 }
1111
]);
12-
expect(result).toEqual([
12+
expect(result).toStrictEqual([
1313
{ from: 0, to: 7.5, width: 7.5, x: 5, y: 10 },
1414
{ from: 7.5, to: 15, width: 7.5, x: 10, y: 10 },
1515
{ from: 25, to: 35, width: 10, x: 30, y: 10 }
1616
]);
1717
});
1818

19-
test('should prevent overlap but small factor', () => {
19+
it('should prevent overlap with factor=1', () => {
20+
let result = broadenPeaks(
21+
[
22+
{ x: 5, y: 10, width: 10 },
23+
{ x: 10, y: 10, width: 10 },
24+
{ x: 30, y: 10, width: 10 }
25+
],
26+
{ factor: 1 }
27+
);
28+
expect(result).toStrictEqual([
29+
{ from: 0, to: 7.5, width: 7.5, x: 5, y: 10 },
30+
{ from: 7.5, to: 15, width: 7.5, x: 10, y: 10 },
31+
{ from: 25, to: 35, width: 10, x: 30, y: 10 }
32+
]);
33+
});
34+
35+
it('should prevent overlap with factor=3', () => {
36+
let result = broadenPeaks(
37+
[
38+
{ x: 5, y: 10, width: 10 },
39+
{ x: 10, y: 10, width: 10 },
40+
{ x: 30, y: 10, width: 10 }
41+
],
42+
{ factor: 3 }
43+
);
44+
expect(result).toStrictEqual([
45+
{ from: -10, to: 7.5, width: 17.5, x: 5, y: 10 },
46+
{ from: 7.5, to: 20, width: 12.5, x: 10, y: 10 },
47+
{ from: 20, to: 45, width: 25, x: 30, y: 10 }
48+
]);
49+
});
50+
51+
it('should prevent overlap but small factor', () => {
2052
let result = broadenPeaks(
2153
[
2254
{ x: 5, y: 10, width: 5 },
@@ -25,14 +57,14 @@ describe('broadenPeaks', () => {
2557
],
2658
{ factor: 0.5 }
2759
);
28-
expect(result).toEqual([
60+
expect(result).toStrictEqual([
2961
{ from: 3.75, to: 6.25, width: 2.5, x: 5, y: 10 },
3062
{ from: 8.75, to: 11.25, width: 2.5, x: 10, y: 10 },
3163
{ from: 28.75, to: 31.25, width: 2.5, x: 30, y: 10 }
3264
]);
3365
});
3466

35-
test('should allow overlap', () => {
67+
it('should allow overlap', () => {
3668
let result = broadenPeaks(
3769
[
3870
{ x: 5, y: 10, width: 5 },
@@ -41,7 +73,7 @@ describe('broadenPeaks', () => {
4173
],
4274
{ overlap: true }
4375
);
44-
expect(result).toEqual([
76+
expect(result).toStrictEqual([
4577
{ from: 0, to: 10, width: 10, x: 5, y: 10 },
4678
{ from: 5, to: 15, width: 10, x: 10, y: 10 },
4779
{ from: 25, to: 35, width: 10, x: 30, y: 10 }

src/post/joinBroadPeaks.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function joinBroadPeaks(peakList, options = {}) {
2121
broadLines.push(peakList.splice(i, 1)[0]);
2222
}
2323
}
24-
// Push a feak peak
24+
// Push a feke peak
2525
broadLines.push({ x: Number.MAX_VALUE });
2626

2727
var candidates = [[broadLines[0].x, broadLines[0].y]];

0 commit comments

Comments
 (0)