/
forge-config_spec.js
39 lines (34 loc) · 1.38 KB
/
forge-config_spec.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
import { expect } from 'chai';
import path from 'path';
import findConfig from '../../src/util/forge-config';
const defaults = {
make_targets: {
win32: ['squirrel', 'appx'],
darwin: ['zip'],
linux: ['deb', 'rpm'],
mas: ['zip'],
},
electronInstallerDMG: {},
electronPackagerConfig: {},
electronWinstallerConfig: {},
electronInstallerDebian: {},
electronInstallerRedhat: {},
};
describe('forge-config', () => {
it('should resolve the object in package.json with defaults if one exists', async () => {
expect(await findConfig(path.resolve(__dirname, '../fixture/dummy_app'))).to.be.deep.equal(Object.assign({}, defaults, {
electronWinstallerConfig: { windows: 'magic' },
windowsStoreConfig: { packageName: 'test' },
}));
});
it('should resolve the JS file exports in config.forge points to a JS file', async () => {
expect(JSON.parse(JSON.stringify(await findConfig(path.resolve(__dirname, '../fixture/dummy_js_conf'))))).to.be.deep.equal(Object.assign({}, defaults, {
electronPackagerConfig: { foo: 'bar' },
}));
});
it('should resolve the JS file exports in config.forge points to a JS file and maintain functions', async () => {
const conf = await findConfig(path.resolve(__dirname, '../fixture/dummy_js_conf'));
expect(conf.magicFn).to.be.a('function');
expect(conf.magicFn()).to.be.equal('magic result');
});
});