forked from nativefier/nativefier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetIconSpec.js
42 lines (34 loc) · 1.07 KB
/
getIconSpec.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
// need to subtract 2 from source maps
import 'source-map-support/register';
import chai from 'chai';
import fs from 'fs';
import os from 'os';
import path from 'path';
import convertToIcns from './../../lib/helpers/convertToIcns';
const assert = chai.assert;
// Prerequisite for test: to use OSX with sips, iconutil and imagemagick convert
function testConvertPng(pngName, done) {
convertToIcns(path.join(__dirname, '../../', 'test-resources', pngName), (error, icnsPath) => {
if (error) {
done(error);
return;
}
const stat = fs.statSync(icnsPath);
assert.isTrue(stat.isFile(), 'Output icns file should be a path');
done();
});
}
describe('Get Icon Module', () => {
it('Can convert icons', () => {
if (os.platform() !== 'darwin') {
console.warn('Skipping png conversion tests, OSX is required');
return;
}
it('Can convert a rgb png to icns', (done) => {
testConvertPng('iconSample.png', done);
});
it('Can convert a grey png to icns', (done) => {
testConvertPng('iconSampleGrey.png', done);
});
});
});