-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
59 lines (50 loc) · 1.42 KB
/
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
var expect = require('chai').expect;
var gulp = require('gulp');
var through = require('through2');
var fs = require('fs');
var del = require('del');
var self = require('./');
describe('gulp-plugin', function() {
it('create atlas with only .tps file', function(done) {
del.sync(['test/dist/*']);
gulp.src('test/atlas.tps')
.pipe(self())
.pipe(through.obj(function (file, enc, cb) {
expect(fs.readFileSync('test/dist/atlas.json')).to.not.be.null;
expect(fs.readFileSync('test/dist/atlas.png')).to.not.be.null;
done();
cb();
}))
this.timeout(8000);
});
it('create atlas with options', function(done) {
del.sync(['test/dist/*']);
gulp.src(['test/*.tps'])
.pipe(self({
sheet:'./test/dist/main.png',
data:'./test/dist/data.json'
}))
.pipe(through.obj(function (file, enc, cb) {
expect(fs.readFileSync('test/dist/data.json')).to.not.be.null;
expect(fs.readFileSync('test/dist/main.png')).to.not.be.null;
done();
cb();
}))
this.timeout(8000);
});
it('create atlas with options and %name%', function(done) {
del.sync(['test/dist/*']);
gulp.src(['test/*.tps'])
.pipe(self({
sheet:'./test/dist/%name%.png',
data:'./test/dist/%name%.json'
}))
.pipe(through.obj(function (file, enc, cb) {
expect(fs.readFileSync('test/dist/atlas.json')).to.not.be.null;
expect(fs.readFileSync('test/dist/atlas.png')).to.not.be.null;
done();
cb();
}))
this.timeout(8000);
});
})