This repository was archived by the owner on Mar 26, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathfilerev_test.js
61 lines (53 loc) · 2.43 KB
/
filerev_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
'use strict';
var fs = require('fs');
var assert = require('assert');
describe('filerev', function () {
it('should revision files based on content', function () {
var original = fs.statSync('test/fixtures/file.png').size;
var revisioned= fs.statSync('test/tmp/file.a0539763.png').size;
assert(revisioned === original);
});
it('should accept options', function () {
var original = fs.statSync('test/fixtures/cfgfile.png').size;
var revisioned= fs.statSync('test/tmp/cfgfile.f64f.png').size;
assert(revisioned === original);
});
it('should allow a dest directory option', function () {
var original = fs.statSync('test/fixtures/file.png').size;
var revisioned= fs.statSync('test/tmp/dest/file.a0539763.png').size;
assert(revisioned === original);
});
it('should allow sources defined with expand', function () {
var original = fs.statSync('test/fixtures/file.png').size;
var revisioned= fs.statSync('test/tmp/expand/file.a0539763.png').size;
assert(revisioned === original);
});
it('should copy the file when copy option is true', function () {
var original = fs.statSync('test/fixtures/another.png').size;
var revisioned= fs.statSync('test/tmp/another.37ba.png').size;
assert(revisioned === original);
var fileExists = fs.existsSync('test/tmp/another.png');
assert(fileExists === true);
});
it('should move the file when copy option is false', function () {
var original = fs.statSync('test/fixtures/movedfile.png').size;
var revisioned= fs.statSync('test/tmp/copyfalse/movedfile.37ba.png').size;
assert(revisioned === original);
var fileExists = fs.existsSync('test/tmp/movedfile.png');
assert(fileExists === false);
});
it('should copy the file without copy option when dest is specified', function () {
var original = fs.statSync('test/fixtures/another.png').size;
var revisioned= fs.statSync('test/tmp/nocopy/another.37ba.png').size;
assert(revisioned === original);
var fileExists = fs.existsSync('test/tmp/another.png');
assert(fileExists === true);
});
it('should move the file without copy option when dest is not specified', function () {
var original = fs.statSync('test/fixtures/movednocopyfile.png').size;
var revisioned= fs.statSync('test/tmp/movednocopyfile.37ba.png').size;
assert(revisioned === original);
var fileExists = fs.existsSync('test/tmp/movednocopyfile.png');
assert(fileExists === false);
});
});