2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-12-23 10:38:55 +00:00
nativefier/test/module/getIcon-spec.js

43 lines
1.2 KiB
JavaScript
Raw Normal View History

// 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';
2016-01-29 06:09:36 +00:00
import pngToIcns from './../../lib/helpers/pngToIcns';
let assert = chai.assert;
// Prerequisite for test: to use OSX with sips, iconutil and imagemagick convert
function testConvertPng(pngName, done) {
pngToIcns(path.join(__dirname, '../../', 'test-resources', pngName), (error, icnsPath) => {
if (error) {
done(error);
return;
}
let stat = fs.statSync(icnsPath);
2016-01-28 03:47:40 +00:00
assert.isTrue(stat.isFile(), 'Output icns file should be a path');
done();
});
}
describe('Get Icon Module', function() {
2016-01-28 15:10:15 +00:00
it('Can convert icons', function() {
if (os.platform() !== 'darwin') {
console.warn('Skipping png conversion tests, OSX is required');
return;
}
it('Can convert a rgb png to icns', function(done) {
testConvertPng('iconSample.png', done);
});
2016-01-28 03:47:40 +00:00
2016-01-28 15:10:15 +00:00
it('Can convert a grey png to icns', function(done) {
testConvertPng('iconSampleGrey.png', done);
});
});
});