Skip to content

Commit df64070

Browse files
write to a tempfile in the tests
1 parent 4b35241 commit df64070

2 files changed

Lines changed: 25 additions & 22 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"devDependencies": {
4141
"ava": "*",
42-
"del": "^2.2.0",
42+
"tempfile": "^1.1.1",
4343
"xo": "*"
4444
}
4545
}

test.js

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
import test from 'ava';
2+
import path from 'path';
23
import pathExists from 'path-exists';
3-
import del from 'del';
4+
import tempfile from 'tempfile';
45
import fn from './';
56

6-
test.after(async () => {
7-
await del(['android', 'ios', 'bb10']);
8-
});
9-
107
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')));
2019
});
2120

2221
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});
2425

25-
t.true(pathExists.sync('ios/icon.png'));
26+
t.true(pathExists.sync(path.join(dest, 'icon.png')));
2627
});
2728

2829
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});
3033

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')));
3538
});

0 commit comments

Comments
 (0)