2020-01-20 15:41:44 +00:00
|
|
|
import assert from 'assert';
|
|
|
|
import { fakeEmbark } from 'embark-testing';
|
2020-03-05 07:55:25 +00:00
|
|
|
|
2020-01-22 11:09:32 +00:00
|
|
|
import Console from '../src';
|
2020-01-20 15:41:44 +00:00
|
|
|
import { version } from '../package.json';
|
|
|
|
|
2020-03-05 07:55:25 +00:00
|
|
|
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["assert", "expect"] }] */
|
|
|
|
|
2020-01-20 15:41:44 +00:00
|
|
|
// Due to our `DAPP_PATH` dependency in `embark-utils` `dappPath()`, we need to
|
|
|
|
// ensure that this environment variable is defined.
|
|
|
|
process.env.DAPP_PATH = 'something';
|
|
|
|
|
|
|
|
describe('core/console', () => {
|
2020-02-20 23:47:01 +00:00
|
|
|
const { embark } = fakeEmbark();
|
2020-01-20 15:41:44 +00:00
|
|
|
let console;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
console = new Console(embark, {
|
|
|
|
ipc: embark.config.ipc,
|
|
|
|
events: embark.events,
|
|
|
|
plugins: embark.plugins,
|
|
|
|
logger: embark.logger,
|
|
|
|
version
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
embark.teardown();
|
|
|
|
});
|
|
|
|
|
2020-03-05 07:55:25 +00:00
|
|
|
it('it should provide a help text', () => {
|
|
|
|
return new Promise(done => {
|
|
|
|
console.executeCmd('help', (_err, output) => {
|
|
|
|
let lines = output.split('\n');
|
|
|
|
assert.equal(lines[0], 'Welcome to Embark ' + version);
|
|
|
|
assert.equal(lines[2], 'possible commands are:');
|
|
|
|
done();
|
|
|
|
});
|
2020-01-20 15:41:44 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|