BREAKING CHANGE(core): switch to esm

This commit is contained in:
2022-08-03 17:00:36 +02:00
parent 311232aeea
commit fa59d2da40
11 changed files with 12174 additions and 8978 deletions

View File

@ -1,43 +1,43 @@
import { tap, expect } from '@pushrocks/tapbundle';
import { Subject } from 'rxjs';
import smartcli = require('../ts/index');
import * as smartcli from '../ts/index.js';
let smartCliTestObject: smartcli.Smartcli;
tap.test('should create a new Smartcli', async () => {
smartCliTestObject = new smartcli.Smartcli();
expect(smartCliTestObject).to.be.instanceof(smartcli.Smartcli);
expect(smartCliTestObject).toBeInstanceOf(smartcli.Smartcli);
});
tap.test('should add an command', async () => {
expect(smartCliTestObject.addCommand('awesome')).to.be.instanceOf(Subject);
expect(smartCliTestObject.addCommand('awesome')).toBeInstanceOf(Subject);
});
tap.test('should start parsing a standardTask', async () => {
expect(smartCliTestObject.standardTask()).to.be.instanceOf(Subject);
expect(smartCliTestObject.standardCommand()).toBeInstanceOf(Subject);
});
let hasExecuted: boolean = false;
tap.test('should accept a command', async () => {
smartCliTestObject.addTrigger('triggerme').subscribe(() => {
smartCliTestObject.addCommand('triggerme').subscribe(() => {
hasExecuted = true;
});
});
tap.test('should not have executed yet', async () => {
expect(hasExecuted).to.be.false;
expect(hasExecuted).toBeFalse();
});
tap.test('should execute when triggered', async () => {
smartCliTestObject.trigger('triggerme');
expect(hasExecuted).be.true;
smartCliTestObject.triggerCommand('triggerme', {});
expect(hasExecuted).toBeTrue();
});
tap.test('should start parsing the CLI input', async () => {
smartCliTestObject.startParse();
expect(smartCliTestObject.parseStarted.promise).to.be.instanceOf(Promise);
expect(smartCliTestObject.parseCompleted.promise).toBeInstanceOf(Promise);
});
tap.start();