Skip to content

Commit ae9e9a5

Browse files
authored
test: remove unnecessary describe levels (#144)
1 parent 3c53e6b commit ae9e9a5

File tree

102 files changed

+6456
-6382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+6456
-6382
lines changed

jest.setup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import { toBeDeepCloseTo } from 'jest-matcher-deep-close-to';
2+
13
import * as jestMatchers from './test/jestMatchers';
24
import * as testUtils from './test/testUtils';
35

46
expect.extend({
7+
toBeDeepCloseTo,
58
...jestMatchers,
69
});
710

src/compute/__tests__/mean.test.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
import { mean } from '../mean';
22

3-
describe('mean', () => {
4-
it('5x1 RGB image', () => {
5-
const image = testUtils.createRgbImage([
6-
[1, 2, 3],
7-
[1, 2, 3],
8-
[1, 2, 3],
9-
[1, 2, 3],
10-
[1, 2, 3],
11-
]);
12-
13-
const result = mean(image);
14-
15-
expect(result).toStrictEqual([1, 2, 3]);
16-
});
17-
it('5x1 RGBA image', () => {
18-
const image = testUtils.createRgbaImage([
19-
[1, 2, 3, 0],
20-
[1, 2, 3, 0],
21-
[11, 2, 3, 0],
22-
[1, 3, 3, 0],
23-
[1, 6, 3, 0],
24-
]);
25-
26-
const result = image.mean();
27-
28-
expect(result).toStrictEqual([3, 3, 3, 0]);
29-
});
30-
it('2x4 GREY image', () => {
31-
const image = testUtils.createGreyImage([
32-
[1, 2, 3, 0],
33-
[1, 2, 3, 0],
34-
]);
35-
36-
const result = image.mean();
37-
38-
expect(result).toStrictEqual([1.5]);
39-
});
3+
test('5x1 RGB image', () => {
4+
const image = testUtils.createRgbImage([
5+
[1, 2, 3],
6+
[1, 2, 3],
7+
[1, 2, 3],
8+
[1, 2, 3],
9+
[1, 2, 3],
10+
]);
11+
12+
const result = mean(image);
13+
14+
expect(result).toStrictEqual([1, 2, 3]);
15+
});
16+
17+
test('5x1 RGBA image', () => {
18+
const image = testUtils.createRgbaImage([
19+
[1, 2, 3, 0],
20+
[1, 2, 3, 0],
21+
[11, 2, 3, 0],
22+
[1, 3, 3, 0],
23+
[1, 6, 3, 0],
24+
]);
25+
26+
const result = image.mean();
27+
28+
expect(result).toStrictEqual([3, 3, 3, 0]);
29+
});
30+
31+
test('2x4 GREY image', () => {
32+
const image = testUtils.createGreyImage([
33+
[1, 2, 3, 0],
34+
[1, 2, 3, 0],
35+
]);
36+
37+
const result = image.mean();
38+
39+
expect(result).toStrictEqual([1.5]);
4040
});

src/compute/__tests__/median.test.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,40 @@
11
import { median } from '../median';
22

3-
describe('median', () => {
4-
it('5x1 RGB image', () => {
5-
const image = testUtils.createRgbImage([
6-
[1, 2, 3],
7-
[1, 2, 3],
8-
[1, 2, 3],
9-
[1, 2, 3],
10-
[1, 2, 3],
11-
]);
12-
13-
const result = median(image);
14-
15-
expect(result).toStrictEqual([1, 2, 3]);
16-
});
17-
it('5x1 RGBA image', () => {
18-
const image = testUtils.createRgbaImage([
19-
[1, 2, 3, 1],
20-
[1, 2, 3, 1],
21-
[11, 2, 3, 2],
22-
[1, 3, 3, 3],
23-
[1, 6, 3, 3],
24-
]);
25-
26-
const result = image.median();
27-
28-
expect(result).toStrictEqual([1, 2, 3, 2]);
29-
});
30-
it('2x4 GREY image', () => {
31-
const image = testUtils.createGreyImage([
32-
[1, 2, 2, 2],
33-
[1, 2, 3, 2],
34-
]);
35-
36-
const result = image.median();
37-
38-
expect(result).toStrictEqual([2]);
39-
});
3+
test('5x1 RGB image', () => {
4+
const image = testUtils.createRgbImage([
5+
[1, 2, 3],
6+
[1, 2, 3],
7+
[1, 2, 3],
8+
[1, 2, 3],
9+
[1, 2, 3],
10+
]);
11+
12+
const result = median(image);
13+
14+
expect(result).toStrictEqual([1, 2, 3]);
15+
});
16+
17+
test('5x1 RGBA image', () => {
18+
const image = testUtils.createRgbaImage([
19+
[1, 2, 3, 1],
20+
[1, 2, 3, 1],
21+
[11, 2, 3, 2],
22+
[1, 3, 3, 3],
23+
[1, 6, 3, 3],
24+
]);
25+
26+
const result = image.median();
27+
28+
expect(result).toStrictEqual([1, 2, 3, 2]);
29+
});
30+
31+
test('2x4 GREY image', () => {
32+
const image = testUtils.createGreyImage([
33+
[1, 2, 2, 2],
34+
[1, 2, 3, 2],
35+
]);
36+
37+
const result = image.median();
38+
39+
expect(result).toStrictEqual([2]);
4040
});

0 commit comments

Comments
 (0)