From a0b7704c753906d00c8cbd7d804256e99632ad8b Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Sun, 26 Nov 2017 13:09:28 -0800 Subject: [PATCH] 'gaia server' -> 'gaia rest-server' --- app/src/main/index.js | 16 +++++++++------- test/unit/specs/main.spec.js | 34 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/app/src/main/index.js b/app/src/main/index.js index e89004a095..9a46256e3b 100644 --- a/app/src/main/index.js +++ b/app/src/main/index.js @@ -197,7 +197,7 @@ app.on('ready', () => createWindow()) async function startBaseserver (home) { log('startBaseserver', home) let child = startProcess(SERVER_BINARY, [ - 'server', + 'rest-server', 'serve', '--home', home // , // '--trust-node' @@ -236,7 +236,7 @@ async function initBaseserver (chainId, home, node) { // fs.ensureDirSync(home) // `baseserver init` to generate config, trust seed let child = startProcess(SERVER_BINARY, [ - 'server', + 'rest-server', 'init', '--home', home, '--chain-id', chainId, @@ -398,19 +398,21 @@ async function main () { log('Picked seed:', nodeIP, 'of', seeds) // replace port with default RPC port nodeIP = `${nodeIP.split(':')[0]}:46657` - log(`Initializing baseserver with remote node ${nodeIP}`) + log(`Initializing REST server with remote node ${nodeIP}`) let baseserverHome = join(root, 'baseserver') if (init) { await initBaseserver(chainId, baseserverHome, nodeIP) } - log('starting gaia server') + log('starting gaia rest-server') baseserverProcess = await startBaseserver(baseserverHome) - log('gaia server ready') + log('gaia rest-server ready') - // start mock API server on port 8999 - mockServer(8999) + if (!TEST) { + // start mock API server on port 8999 + mockServer(8999) + } } module.exports = Object.assign( main() diff --git a/test/unit/specs/main.spec.js b/test/unit/specs/main.spec.js index 40d1235104..32ca02446e 100644 --- a/test/unit/specs/main.spec.js +++ b/test/unit/specs/main.spec.js @@ -63,22 +63,22 @@ describe('Startup Process', () => { expect(fs.existsSync(testRoot)).toBe(true) }) - it('should init gaia server with correct testnet', async function () { + it('should init gaia rest-server with correct testnet', async function () { expect(childProcess.spawn.mock.calls .find(([path, args]) => path.includes('gaia') && - args.includes('server') && + args.includes('rest-server') && args.includes('init') && args.splice(1).join('=').includes('--chain-id=gaia-1') ) ).toBeDefined() }) - it('should start gaia server', async function () { + it('should start gaia rest-server', async function () { expect(childProcess.spawn.mock.calls .find(([path, args]) => path.includes('gaia') && - args.includes('server') && + args.includes('rest-server') && args.includes('serve') ) ).toBeDefined() @@ -92,7 +92,7 @@ describe('Startup Process', () => { }) // TODO the stdout.on('data') trick doesn't work - xit('should init gaia server accepting the new app hash', async function () { + xit('should init gaia rest-server accepting the new app hash', async function () { await resetConfigs() let mockWrite = jest.fn() childProcessMock((path, args) => ({ @@ -101,7 +101,7 @@ describe('Startup Process', () => { }, stdout: { on: (type, cb) => { - if (type === 'data' && path.includes('gaia') && args[0] === 'server' && args[1] === 'init') { + if (type === 'data' && path.includes('gaia') && args[0] === 'rest-server' && args[1] === 'init') { cb('Will you accept the hash?') } } @@ -144,7 +144,7 @@ describe('Startup Process', () => { }, stdout: { on: (type, cb) => { - if (type === 'data' && path.includes('gaia') && args[0] === 'server' && args[1] === 'init') { + if (type === 'data' && path.includes('gaia') && args[0] === 'rest-server' && args[1] === 'init') { cb('Will you accept the hash?') } } @@ -177,22 +177,22 @@ describe('Startup Process', () => { expect(fs.existsSync(testRoot)).toBe(true) }) - it('should init gaia server with correct testnet', async function () { + it('should init gaia rest-server with correct testnet', async function () { expect(childProcess.spawn.mock.calls .find(([path, args]) => path.includes('gaia') && - args.includes('server') && + args.includes('rest-server') && args.includes('init') && args.splice(1).join('=').includes('--chain-id=gaia-1') ) ).toBeDefined() }) - it('should start gaia server', async function () { + it('should start gaia rest-server', async function () { expect(childProcess.spawn.mock.calls .find(([path, args]) => path.includes('gaia') && - args.includes('server') && + args.includes('rest-server') && args.includes('serve') ) ).toBeDefined() @@ -225,21 +225,21 @@ describe('Startup Process', () => { describe('Start initialized', function () { mainSetup() - it('should not init gaia server again', async function () { + it('should not init gaia rest-server again', async function () { expect(childProcess.spawn.mock.calls .find(([path, args]) => path.includes('gaia') && - args.includes('server') && + args.includes('rest-server') && args.includes('init') ) ).toBeUndefined() }) - it('should start gaia server', async function () { + it('should start gaia rest-server', async function () { expect(childProcess.spawn.mock.calls .find(([path, args]) => path.includes('gaia') && - args.includes('server') && + args.includes('rest-server') && args.includes('serve') ) ).toBeDefined() @@ -277,7 +277,7 @@ describe('Startup Process', () => { afterEach(function () { main.shutdown() }) - it('should rerun gaia server if gaia server fails', async function () { + it('should rerun gaia rest-server if gaia rest-server fails', async function () { failingChildProcess('gaia', 'serve') await initMain() @@ -286,7 +286,7 @@ describe('Startup Process', () => { expect(childProcess.spawn.mock.calls .find(([path, args]) => path.includes('gaia') && - args.includes('server') && + args.includes('rest-server') && args.includes('serve') ).length ).toBeGreaterThan(1)