embark/packages/core/console/test/console.spec.js
emizzle 471a33a331 chore(@embark/blockchain): Add unit tests to blockchain stack component
fix(@embark/blockchain): Add callback to `blockchain:node:register` and `blockchain:client:register`

Add unit tests for the stack/blockchain and update supporting API documentation in the Wiki.

Add injectables `Web3` and `warnIfPackageNotDefinedLocally` to stack/blockchain so that those functions can be tested properly.

Update stack/blockchain dependencies in `package.json`.
2020-03-20 14:40:14 +01:00

42 lines
1.1 KiB
JavaScript

import assert from 'assert';
import { fakeEmbark } from 'embark-testing';
import Console from '../src';
import { version } from '../package.json';
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["assert", "expect"] }] */
// 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', () => {
const { embark } = fakeEmbark();
let console;
beforeEach(() => {
console = new Console(embark, {
ipc: embark.ipc,
events: embark.events,
plugins: embark.plugins,
logger: embark.logger,
version
});
});
afterEach(() => {
embark.teardown();
});
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();
});
});
});
});