forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FailedTestsCache.test.js
63 lines (60 loc) · 1.52 KB
/
FailedTestsCache.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import FailedTestsCache from '../FailedTestsCache';
describe('FailedTestsCache', () => {
test('should filter tests', () => {
const failedTestsCache = new FailedTestsCache();
failedTestsCache.setTestResults([
{
numFailingTests: 0,
testFilePath: '/path/to/passing.js',
testResults: [
{fullName: 'test 1', status: 'passed'},
{fullName: 'test 2', status: 'passed'},
],
},
{
numFailingTests: 2,
testFilePath: '/path/to/failed_1.js',
testResults: [
{fullName: 'test 3', status: 'failed'},
{fullName: 'test 4', status: 'failed'},
],
},
{
numFailingTests: 1,
testFilePath: '/path/to/failed_2.js',
testResults: [
{fullName: 'test 5', status: 'failed'},
{fullName: 'test 6', status: 'passed'},
],
},
]);
const result = failedTestsCache.filterTests([
{
path: '/path/to/passing.js',
},
{
path: '/path/to/failed_1.js',
},
{
path: '/path/to/failed_2.js',
},
{
path: '/path/to/unknown.js',
},
]);
expect(result).toMatchObject([
{
path: '/path/to/failed_1.js',
},
{
path: '/path/to/failed_2.js',
},
]);
});
});