forked from excellenteasy/android-icon-resize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
executable file
·73 lines (69 loc) · 3.05 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'use strict'
var test = require('tape')
var resize = require('./')
var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var exec = require('child_process').exec
test('creates all icons in tmp directory', function (t) {
t.plan(5)
rimraf('tmp', function () {
mkdirp('tmp', function () {
resize('test/com.appbusinesspodcast.www.png', 'tmp/').then(function () {
t.ok(fs.existsSync('tmp/mdpi.png'), 'mdpi.png created')
t.ok(fs.existsSync('tmp/hdpi.png'), 'hdpi.png created')
t.ok(fs.existsSync('tmp/xhdpi.png'), 'xhdpi.png created')
t.ok(fs.existsSync('tmp/xxhdpi.png'), 'xxhdpi.png created')
t.ok(fs.existsSync('tmp/xxxhdpi.png'), 'xxxhdpi.png created')
})
})
})
})
test('cli all icons in tmp directory', function (t) {
t.plan(15)
rimraf('tmp', function () {
mkdirp('tmp', function () {
exec('./bin/android-icon-resize.js --input test/com.appbusinesspodcast.www.png --output tmp', function (error, stdout, stderr) {
var err = error || stderr
if (err) {
return t.fail('calling cli produced an error: ' + err)
}
t.ok(fs.existsSync('tmp/mdpi.png'), 'mdpi.png created')
t.ok(fs.existsSync('tmp/hdpi.png'), 'hdpi.png created')
t.ok(fs.existsSync('tmp/xhdpi.png'), 'xhdpi.png created')
t.ok(fs.existsSync('tmp/xxhdpi.png'), 'xxhdpi.png created')
t.ok(fs.existsSync('tmp/xxxhdpi.png'), 'xxxhdpi.png created')
rimraf('tmp', function () {
mkdirp('tmp', function () {
exec('./bin/android-icon-resize.js --in test/com.appbusinesspodcast.www.png --ou tmp', function (error, stdout, stderr) {
var err = error || stderr
if (err) {
return t.fail('calling cli produced an error: ' + err)
}
t.ok(fs.existsSync('tmp/mdpi.png'), 'mdpi.png created')
t.ok(fs.existsSync('tmp/hdpi.png'), 'hdpi.png created')
t.ok(fs.existsSync('tmp/xhdpi.png'), 'xhdpi.png created')
t.ok(fs.existsSync('tmp/xxhdpi.png'), 'xxhdpi.png created')
t.ok(fs.existsSync('tmp/xxxhdpi.png'), 'xxxhdpi.png created')
rimraf('tmp', function () {
mkdirp('tmp', function () {
exec('./bin/android-icon-resize.js -i test/com.appbusinesspodcast.www.png -o tmp', function (error, stdout, stderr) {
var err = error || stderr
if (err) {
return t.fail('calling cli produced an error: ' + err)
}
t.ok(fs.existsSync('tmp/mdpi.png'), 'mdpi.png created')
t.ok(fs.existsSync('tmp/hdpi.png'), 'hdpi.png created')
t.ok(fs.existsSync('tmp/xhdpi.png'), 'xhdpi.png created')
t.ok(fs.existsSync('tmp/xxhdpi.png'), 'xxhdpi.png created')
t.ok(fs.existsSync('tmp/xxxhdpi.png'), 'xxxhdpi.png created')
})
})
})
})
})
})
})
})
})
})