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