1 | const describe = require('mocha').describe
|
2 | const exec = require('child_process').exec
|
3 | const it = require('mocha').it
|
4 |
|
5 | require('chai').should()
|
6 |
|
7 | describe('cli', function() {
|
8 | it('Should run on CLI (with glob support)', function(done) {
|
9 | const command = [
|
10 | 'cp test/samples/image_2.jpg test/samples/image_2.cli.jpg',
|
11 | 'cp test/samples/image_3.jpg test/samples/image_3.cli.jpg',
|
12 | 'cp test/samples/image_4.jpg test/samples/image_4.cli.jpg',
|
13 | './src/cli.js test/samples/image_2.cli.jpg "test/samples/image_{3,4}.cli.jpg" --quality=85',
|
14 | 'rm test/samples/image_2.cli.jpg',
|
15 | 'rm test/samples/image_3.cli.jpg',
|
16 | 'rm test/samples/image_4.cli.jpg',
|
17 | ]
|
18 | exec(command.join(' && '), function(error, stdout, stderr) {
|
19 | stdout.should.be.a('string').and.contain('Processed (Orientation was 2) (Quality 85%)')
|
20 | stdout.should.be.a('string').and.contain('Processed (Orientation was 3) (Quality 85%)')
|
21 | stdout.should.be.a('string').and.contain('Processed (Orientation was 4) (Quality 85%)')
|
22 | stderr.should.equal('')
|
23 | done()
|
24 | })
|
25 | })
|
26 | })
|