/
copy_test.js
57 lines (42 loc) · 1.64 KB
/
copy_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
var grunt = require('grunt');
var fs = require('fs');
exports.copy = {
main: function(test) {
'use strict';
test.expect(3);
var actual = fs.readdirSync('tmp/copy_test_files').sort();
var expected = fs.readdirSync('test/expected/copy_test_files').sort();
test.deepEqual(expected, actual, 'should copy several files');
actual = fs.readdirSync('tmp/copy_test_mix').sort();
expected = fs.readdirSync('test/expected/copy_test_mix').sort();
test.deepEqual(expected, actual, 'should copy a mix of folders and files');
actual = fs.readdirSync('tmp/copy_test_v0.1.0').sort();
expected = fs.readdirSync('test/expected/copy_test_v0.1.0').sort();
test.deepEqual(expected, actual, 'should parse both dest and src templates');
test.done();
},
flatten: function(test) {
'use strict';
test.expect(1);
var actual = fs.readdirSync('tmp/copy_test_flatten').sort();
var expected = fs.readdirSync('test/expected/copy_test_flatten').sort();
test.deepEqual(expected, actual, 'should create a flat structure');
test.done();
},
minimatch: function(test) {
'use strict';
test.expect(1);
var actual = fs.readdirSync('tmp/copy_minimatch').sort();
var expected = fs.readdirSync('test/expected/copy_minimatch').sort();
test.deepEqual(expected, actual, 'should allow for minimatch dot option');
test.done();
},
single: function(test) {
'use strict';
test.expect(1);
var actual = grunt.file.read('tmp/single.js');
var expected = grunt.file.read('test/expected/single.js');
test.equal(expected, actual, 'should allow for single file copy');
test.done();
}
};