forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfailed_tests_cache.test.js
More file actions
62 lines (60 loc) · 1.53 KB
/
failed_tests_cache.test.js
File metadata and controls
62 lines (60 loc) · 1.53 KB
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
import FailedTestsCache from '../failed_tests_cache';
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',
},
]);
expect(failedTestsCache.updateConfig({})).toMatchObject({
enabledTestsMap: {
'/path/to/failed_1.js': {'test 3': true, 'test 4': true},
'/path/to/failed_2.js': {'test 5': true},
},
});
});
});