@@ -6,157 +6,157 @@ const url = require( 'url' );
6
6
const trac = require ( '../lib/trac.js' ) ;
7
7
const mapOldToNewFilePath = require ( '../lib/map_old_to_new_file_path.js' ) ;
8
8
9
- describe ( 'grunt_patch_wordpress' , function ( ) {
10
- describe ( 'sanity checks' , function ( ) {
11
- it ( 'a is a' , function ( ) {
9
+ describe ( 'grunt_patch_wordpress' , ( ) => {
10
+ describe ( 'sanity checks' , ( ) => {
11
+ it ( 'a is a' , ( ) => {
12
12
expect ( 'a' ) . toEqual ( 'a' ) ;
13
13
} ) ;
14
14
} ) ;
15
15
16
- it ( 'convertToRaw converts urls' , function ( ) {
16
+ it ( 'convertToRaw converts urls' , ( ) => {
17
17
expect ( trac . convertToRaw ( url . parse ( 'https://core.trac.wordpress.org/attachment/ticket/26700/26700.diff' ) ) ) . toEqual ( 'https://core.trac.wordpress.org/raw-attachment/ticket/26700/26700.diff' ) ;
18
18
} ) ;
19
19
20
- describe ( 'Level Calculator' , function ( ) {
20
+ describe ( 'Level Calculator' , ( ) => {
21
21
// @TODO : Find alot of patches to use here
22
22
23
- it ( '26602.2.diff is 0' , function ( ) {
23
+ it ( '26602.2.diff is 0' , ( ) => {
24
24
const file = grunt . file . read ( 'test/fixtures/26602.2.diff' ) ;
25
25
expect ( patch . isAb ( file ) ) . toBe ( false ) ;
26
26
} ) ;
27
27
} ) ;
28
28
29
- describe ( 'mapOldToNewFilePath' , function ( ) {
29
+ describe ( 'mapOldToNewFilePath' , ( ) => {
30
30
const fileMappings = {
31
31
'src/wp-admin/js/color-picker.js' : 'src/js/_enqueues/lib/color-picker.js' ,
32
32
'wp-admin/js/color-picker.js' : 'js/_enqueues/lib/color-picker.js' ,
33
33
} ;
34
34
35
- describe ( 'old to new' , function ( ) {
36
- beforeAll ( function ( ) {
35
+ describe ( 'old to new' , ( ) => {
36
+ beforeAll ( ( ) => {
37
37
grunt . file . copy ( './test/fixtures/patch_wordpress_1.diff' , './test/tmp/patch_wordpress_1_copy.diff' ) ;
38
38
mapOldToNewFilePath ( './test/tmp/patch_wordpress_1_copy.diff' , fileMappings ) ;
39
39
} ) ;
40
40
41
- it ( 'replaces old file paths with new file paths in the diff' , function ( ) {
41
+ it ( 'replaces old file paths with new file paths in the diff' , ( ) => {
42
42
const expected = grunt . file . read ( './test/expected/patch_wordpress_1.diff' ) ;
43
43
const actual = grunt . file . read ( './test/tmp/patch_wordpress_1_copy.diff' ) ;
44
44
45
45
expect ( actual ) . toEqual ( expected ) ;
46
46
} ) ;
47
47
48
- afterAll ( function ( ) {
48
+ afterAll ( ( ) => {
49
49
grunt . file . delete ( './test/tmp/patch_wordpress_1_copy.diff' ) ;
50
50
} ) ;
51
51
} ) ;
52
52
53
- describe ( 'new stay unchanged' , function ( ) {
54
- beforeAll ( function ( ) {
53
+ describe ( 'new stay unchanged' , ( ) => {
54
+ beforeAll ( ( ) => {
55
55
grunt . file . copy ( './test/fixtures/patch_wordpress_2.diff' , './test/tmp/patch_wordpress_2_copy.diff' ) ;
56
56
mapOldToNewFilePath ( './test/tmp/patch_wordpress_2_copy.diff' , fileMappings ) ;
57
57
} ) ;
58
58
59
- it ( 'doesn\'t replace new file paths' , function ( ) {
59
+ it ( 'doesn\'t replace new file paths' , ( ) => {
60
60
const expected = grunt . file . read ( './test/expected/patch_wordpress_2.diff' ) ;
61
61
const actual = grunt . file . read ( './test/tmp/patch_wordpress_2_copy.diff' ) ;
62
62
63
63
expect ( actual ) . toEqual ( expected ) ;
64
64
} ) ;
65
65
66
- afterAll ( function ( ) {
66
+ afterAll ( ( ) => {
67
67
grunt . file . delete ( './test/tmp/patch_wordpress_2_copy.diff' ) ;
68
68
} ) ;
69
69
} ) ;
70
70
71
- describe ( 'unknown stay unchanged' , function ( ) {
72
- beforeAll ( function ( ) {
71
+ describe ( 'unknown stay unchanged' , ( ) => {
72
+ beforeAll ( ( ) => {
73
73
grunt . file . copy ( './test/fixtures/patch_wordpress_3.diff' , './test/tmp/patch_wordpress_3_copy.diff' ) ;
74
74
mapOldToNewFilePath ( './test/tmp/patch_wordpress_3_copy.diff' , fileMappings ) ;
75
75
} ) ;
76
76
77
- it ( 'doesn\'t replace file paths that are not in the file mappings object' , function ( ) {
77
+ it ( 'doesn\'t replace file paths that are not in the file mappings object' , ( ) => {
78
78
const expected = grunt . file . read ( './test/expected/patch_wordpress_3.diff' ) ;
79
79
const actual = grunt . file . read ( './test/tmp/patch_wordpress_3_copy.diff' ) ;
80
80
81
81
expect ( actual ) . toEqual ( expected ) ;
82
82
} ) ;
83
83
84
- afterAll ( function ( ) {
84
+ afterAll ( ( ) => {
85
85
grunt . file . delete ( './test/tmp/patch_wordpress_3_copy.diff' ) ;
86
86
} ) ;
87
87
} ) ;
88
88
89
- describe ( 'new stay unchanged, old to new' , function ( ) {
90
- beforeAll ( function ( ) {
89
+ describe ( 'new stay unchanged, old to new' , ( ) => {
90
+ beforeAll ( ( ) => {
91
91
grunt . file . copy ( './test/fixtures/patch_wordpress_4.diff' , './test/tmp/patch_wordpress_4_copy.diff' ) ;
92
92
mapOldToNewFilePath ( './test/tmp/patch_wordpress_4_copy.diff' , fileMappings ) ;
93
93
} ) ;
94
94
95
95
it ( 'replaces old file paths with new file paths but doesn\'t replace file paths that are not ' +
96
- 'in the file mappings object in a diff file with multiple diffs' , function ( ) {
96
+ 'in the file mappings object in a diff file with multiple diffs' , ( ) => {
97
97
const expected = grunt . file . read ( './test/expected/patch_wordpress_4.diff' ) ;
98
98
const actual = grunt . file . read ( './test/tmp/patch_wordpress_4_copy.diff' ) ;
99
99
100
100
expect ( actual ) . toEqual ( expected ) ;
101
101
} ) ;
102
102
103
- afterAll ( function ( ) {
103
+ afterAll ( ( ) => {
104
104
grunt . file . delete ( './test/tmp/patch_wordpress_4_copy.diff' ) ;
105
105
} ) ;
106
106
} ) ;
107
107
108
- describe ( 'new and unknown stay unchanged' , function ( ) {
109
- beforeAll ( function ( ) {
108
+ describe ( 'new and unknown stay unchanged' , ( ) => {
109
+ beforeAll ( ( ) => {
110
110
grunt . file . copy ( './test/fixtures/patch_wordpress_5.diff' , './test/tmp/patch_wordpress_5_copy.diff' ) ;
111
111
mapOldToNewFilePath ( './test/tmp/patch_wordpress_5_copy.diff' , fileMappings ) ;
112
112
} ) ;
113
113
114
114
it ( 'doesn\'t replaces new file paths and file paths that are not in the file mappings object in a diff file' +
115
- ' with multiple diffs' , function ( ) {
115
+ ' with multiple diffs' , ( ) => {
116
116
const expected = grunt . file . read ( './test/expected/patch_wordpress_5.diff' ) ;
117
117
const actual = grunt . file . read ( './test/tmp/patch_wordpress_5_copy.diff' ) ;
118
118
119
119
expect ( actual ) . toEqual ( expected ) ;
120
120
} ) ;
121
121
122
- afterAll ( function ( ) {
122
+ afterAll ( ( ) => {
123
123
grunt . file . delete ( './test/tmp/patch_wordpress_5_copy.diff' ) ;
124
124
} ) ;
125
125
} ) ;
126
126
127
- describe ( 'new and unknown stay unchanged, old to new' , function ( ) {
128
- beforeAll ( function ( ) {
127
+ describe ( 'new and unknown stay unchanged, old to new' , ( ) => {
128
+ beforeAll ( ( ) => {
129
129
grunt . file . copy ( './test/fixtures/patch_wordpress_6.diff' , './test/tmp/patch_wordpress_6_copy.diff' ) ;
130
130
mapOldToNewFilePath ( './test/tmp/patch_wordpress_6_copy.diff' , fileMappings ) ;
131
131
} ) ;
132
132
133
- it ( 'only replaces old file paths in a diff file with multiple diffs' , function ( ) {
133
+ it ( 'only replaces old file paths in a diff file with multiple diffs' , ( ) => {
134
134
const expected = grunt . file . read ( './test/expected/patch_wordpress_6.diff' ) ;
135
135
const actual = grunt . file . read ( './test/tmp/patch_wordpress_6_copy.diff' ) ;
136
136
137
137
expect ( actual ) . toEqual ( expected ) ;
138
138
} ) ;
139
139
140
- afterAll ( function ( ) {
140
+ afterAll ( ( ) => {
141
141
grunt . file . delete ( './test/tmp/patch_wordpress_6_copy.diff' ) ;
142
142
} ) ;
143
143
} ) ;
144
144
145
145
// There is no src folder in core.
146
- describe ( 'non-src old to new' , function ( ) {
147
- beforeAll ( function ( ) {
146
+ describe ( 'non-src old to new' , ( ) => {
147
+ beforeAll ( ( ) => {
148
148
grunt . file . copy ( './test/fixtures/patch_wordpress_7.diff' , './test/tmp/patch_wordpress_7_copy.diff' ) ;
149
149
mapOldToNewFilePath ( './test/tmp/patch_wordpress_7_copy.diff' , fileMappings ) ;
150
150
} ) ;
151
151
152
- it ( 'replaces old file paths with new file paths in a diff with non-src file paths' , function ( ) {
152
+ it ( 'replaces old file paths with new file paths in a diff with non-src file paths' , ( ) => {
153
153
const expected = grunt . file . read ( './test/expected/patch_wordpress_7.diff' ) ;
154
154
const actual = grunt . file . read ( './test/tmp/patch_wordpress_7_copy.diff' ) ;
155
155
156
156
expect ( actual ) . toEqual ( expected ) ;
157
157
} ) ;
158
158
159
- afterAll ( function ( ) {
159
+ afterAll ( ( ) => {
160
160
grunt . file . delete ( './test/tmp/patch_wordpress_7_copy.diff' ) ;
161
161
} ) ;
162
162
} ) ;
0 commit comments