|
1 | 1 | import test from 'ava'; |
| 2 | +import path from 'path'; |
2 | 3 | import pathExists from 'path-exists'; |
3 | | -import del from 'del'; |
| 4 | +import tempfile from 'tempfile'; |
4 | 5 | import fn from './'; |
5 | 6 |
|
6 | | -test.after(async () => { |
7 | | - await del(['android', 'ios', 'bb10']); |
8 | | -}); |
9 | | - |
10 | 7 | test('android', async t => { |
11 | | - await fn('./fixtures/icon.png', {platform: 'android', dest: 'android'}); |
12 | | - |
13 | | - t.true(pathExists.sync('android/drawable/icon.png')); |
14 | | - t.true(pathExists.sync('android/drawable-ldpi/icon.png')); |
15 | | - t.true(pathExists.sync('android/drawable-mdpi/icon.png')); |
16 | | - t.true(pathExists.sync('android/drawable-hdpi/icon.png')); |
17 | | - t.true(pathExists.sync('android/drawable-xhdpi/icon.png')); |
18 | | - t.true(pathExists.sync('android/drawable-xxhdpi/icon.png')); |
19 | | - t.true(pathExists.sync('android/drawable-xxxhdpi/icon.png')); |
| 8 | + const dest = tempfile(); |
| 9 | + |
| 10 | + await fn('./fixtures/icon.png', {platform: 'android', dest: dest}); |
| 11 | + |
| 12 | + t.true(pathExists.sync(path.join(dest, 'drawable/icon.png'))); |
| 13 | + t.true(pathExists.sync(path.join(dest, 'drawable-ldpi/icon.png'))); |
| 14 | + t.true(pathExists.sync(path.join(dest, 'drawable-mdpi/icon.png'))); |
| 15 | + t.true(pathExists.sync(path.join(dest, 'drawable-hdpi/icon.png'))); |
| 16 | + t.true(pathExists.sync(path.join(dest, 'drawable-xhdpi/icon.png'))); |
| 17 | + t.true(pathExists.sync(path.join(dest, 'drawable-xxhdpi/icon.png'))); |
| 18 | + t.true(pathExists.sync(path.join(dest, 'drawable-xxxhdpi/icon.png'))); |
20 | 19 | }); |
21 | 20 |
|
22 | 21 | test('ios', async t => { |
23 | | - await fn('./fixtures/icon.png', {platform: 'ios', dest: 'ios'}); |
| 22 | + const dest = tempfile(); |
| 23 | + |
| 24 | + await fn('./fixtures/icon.png', {platform: 'ios', dest: dest}); |
24 | 25 |
|
25 | | - t.true(pathExists.sync('ios/icon.png')); |
| 26 | + t.true(pathExists.sync(path.join(dest, 'icon.png'))); |
26 | 27 | }); |
27 | 28 |
|
28 | 29 | test('bb10', async t => { |
29 | | - await fn('./fixtures/icon.png', {platform: 'blackberry10', dest: 'bb10'}); |
| 30 | + const dest = tempfile(); |
| 31 | + |
| 32 | + await fn('./fixtures/icon.png', {platform: 'blackberry10', dest: dest}); |
30 | 33 |
|
31 | | - t.true(pathExists.sync('bb10/icon-90.png')); |
32 | | - t.true(pathExists.sync('bb10/icon-96.png')); |
33 | | - t.true(pathExists.sync('bb10/icon-110.png')); |
34 | | - t.true(pathExists.sync('bb10/icon-144.png')); |
| 34 | + t.true(pathExists.sync(path.join(dest, 'icon-90.png'))); |
| 35 | + t.true(pathExists.sync(path.join(dest, 'icon-96.png'))); |
| 36 | + t.true(pathExists.sync(path.join(dest, 'icon-110.png'))); |
| 37 | + t.true(pathExists.sync(path.join(dest, 'icon-144.png'))); |
35 | 38 | }); |
0 commit comments