Mailspring/spec_integration/helpers/config-helper.es6
Evan Morikawa 4014b4e187 feat(spec): add config dir to integration specs
Summary:
- You can now pass `--config-dir-path=/some/custom/path` to `./N1.sh`
- `main.coffee` cleaned up a bit. A lot of unused params from legacy Atom
  stuff were still being used
- Integration specs now set the config dir before booting.
- New spec to check for the autoupdater in the app and make sure it's
  pointing at the right place.

Test Plan: script/grunt run-integration-tests

Reviewers: juan, bengotow

Reviewed By: bengotow

Differential Revision: https://phab.nylas.com/D2331
2015-12-10 10:52:20 -05:00

27 lines
939 B
JavaScript

import fs from 'fs-plus'
import path from 'path'
import CSON from 'season'
var root = path.resolve(path.dirname(__dirname))
const DEFAULT_CONFIG_DIR = path.join(root, "fixtures", "default_test_config")
export const CONFIG_DIR_PATH = path.join(root, ".integration-test-config")
export const FAKE_DATA_PATH = path.join(root, "fixtures", "test_account_data")
export function setupDefaultConfig() {
if (fs.existsSync(CONFIG_DIR_PATH)) fs.removeSync(CONFIG_DIR_PATH);
fs.copySync(DEFAULT_CONFIG_DIR, CONFIG_DIR_PATH)
}
export function clearConfig() {
if (fs.existsSync(CONFIG_DIR_PATH)) fs.removeSync(CONFIG_DIR_PATH);
}
export function currentConfig(){
version = JSON.parse(fs.readFileSync(path.join(root, '..', 'package.json'))).version;
config = CSON.readFileSync(path.join(DEFAULT_CONFIG_DIR, 'config.cson'))["*"]
id = config.updateIdentity
email = config.nylas.accounts[0].email_address
return {id, email, version}
}