embark/test/console.js
Cryptomental 47dcb1552c
console, dashboard: Add persistent, automatically loaded history.
Add persistent automatically loaded history file for repl console
and Embark dashboard.

Default location of the history file is stored in DEFAULT_CMD_HISTORY_PATH
pointing to DAPP_PATH/.embark/cmd_history.

The history is automatically saved and loaded on startup.

test/console: Pass Embark object to constructor.

Update console test to pass Embark object to constructor.

Refs: https://github.com/embark-framework/embark/issues/939
2018-10-22 19:54:43 +02:00

42 lines
1.2 KiB
JavaScript

/*globals describe, it*/
let Console = require('../lib/modules/console/');
let Plugins = require('../lib/core/plugins.js');
let IPC = require('../lib/core/ipc.js');
let assert = require('assert');
let version = require('../package.json').version;
describe('embark.Console', function() {
let ipc = new IPC({ipcRole: 'none'});
let plugins = new Plugins({plugins: {}});
let events = {once: () => {}, setCommandHandler: () => {}, emit: () => {}};
let embarkObject = {
events: events,
logger: plugins.logger,
registerConsoleCommand: (cmd, opt) => {},
embarkConfig: {
options: {
solc: {
"optimize": true,
"optimize-runs": 200
}
}
}
}
let console = new Console(embarkObject, {plugins, version, ipc, events});
describe('#executeCmd', function() {
describe('command: help', function() {
it('it should provide a help text', function(done) {
console.executeCmd('help', function(_err, output) {
let lines = output.split('\n');
assert.equal(lines[0], 'Welcome to Embark ' + version);
assert.equal(lines[2], 'possible commands are:');
done();
});
});
});
});
});