mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
fix config test for windows (#72)
This commit is contained in:
parent
f8037ffd66
commit
8d199e3599
@ -1,6 +1,7 @@
|
|||||||
const { getConfigField, updateConfigField, configFileName } = require('../js/config');
|
const { getConfigField, updateConfigField, configFileName } = require('../js/config');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const os = require('os');
|
||||||
|
|
||||||
// mock required so getConfig reads config from correct path
|
// mock required so getConfig reads config from correct path
|
||||||
jest.mock('../js/utils/misc.js', function() {
|
jest.mock('../js/utils/misc.js', function() {
|
||||||
@ -58,12 +59,14 @@ describe('getConfigField tests', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createTempUserConfig(config) {
|
function createTempUserConfig(config) {
|
||||||
userConfigDir = fs.mkdtempSync('/tmp/config-');
|
var tmpDir = os.tmpdir();
|
||||||
|
userConfigDir = fs.mkdtempSync(path.join(tmpDir, 'config-'));
|
||||||
return createTempConfigFile(path.join(userConfigDir, configFileName), config);
|
return createTempConfigFile(path.join(userConfigDir, configFileName), config);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTempGlobalConfig(config) {
|
function createTempGlobalConfig(config) {
|
||||||
globalConfigDir = path.join(fs.mkdtempSync('/tmp/config-'), 'config');
|
var tmpDir = os.tmpdir();
|
||||||
|
globalConfigDir = path.join(fs.mkdtempSync(path.join(tmpDir, 'config-')), 'config');
|
||||||
fs.mkdirSync(globalConfigDir);
|
fs.mkdirSync(globalConfigDir);
|
||||||
return createTempConfigFile(path.join(globalConfigDir, configFileName), config);
|
return createTempConfigFile(path.join(globalConfigDir, configFileName), config);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user