fix(core): update
This commit is contained in:
60
test/test.ts
60
test/test.ts
@ -1,45 +1,45 @@
|
||||
import { tap, expect } from 'tapbundle'
|
||||
import * as smartchok from '../ts/index'
|
||||
import * as smartfile from 'smartfile'
|
||||
import * as smartq from 'smartq'
|
||||
import * as rx from 'rxjs/Rx'
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import * as smartchok from '../ts/index';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as rx from 'rxjs/Rx';
|
||||
|
||||
// the module to test
|
||||
|
||||
let testSmartchok: smartchok.Smartchok
|
||||
let testAddObservable: rx.Observable<any>
|
||||
let testSubscription: rx.Subscription
|
||||
let testSmartchok: smartchok.Smartchok;
|
||||
let testAddObservable: rx.Observable<any>;
|
||||
let testSubscription: rx.Subscription;
|
||||
tap.test('should create a new instance', async () => {
|
||||
testSmartchok = new smartchok.Smartchok([])
|
||||
expect(testSmartchok).to.be.instanceof(smartchok.Smartchok)
|
||||
})
|
||||
testSmartchok = new smartchok.Smartchok([]);
|
||||
expect(testSmartchok).to.be.instanceof(smartchok.Smartchok);
|
||||
});
|
||||
|
||||
tap.test('should add some files to watch and start', async () => {
|
||||
testSmartchok.add([ './test/assets/**/*.txt' ])
|
||||
testSmartchok.add(['./test/assets/**/*.txt']);
|
||||
let localPromise = testSmartchok.start().then(async () => {
|
||||
testSmartchok.add([ './test/assets/**/*.md' ])
|
||||
})
|
||||
await expect(localPromise).to.eventually.be.fulfilled
|
||||
})
|
||||
testSmartchok.add(['./test/assets/**/*.md']);
|
||||
});
|
||||
await expect(localPromise).to.eventually.be.fulfilled;
|
||||
});
|
||||
|
||||
tap.test('should get an observable for a certain event', async () => {
|
||||
let localPromise = testSmartchok.getObservableFor('add').then(async (observableArg) => {
|
||||
testAddObservable = observableArg
|
||||
})
|
||||
await expect(localPromise).to.eventually.be.fulfilled
|
||||
})
|
||||
let localPromise = testSmartchok.getObservableFor('add').then(async observableArg => {
|
||||
testAddObservable = observableArg;
|
||||
});
|
||||
await expect(localPromise).to.eventually.be.fulfilled;
|
||||
});
|
||||
|
||||
tap.test('should register an add operation', async () => {
|
||||
let testDeferred = smartq.defer()
|
||||
let testDeferred = smartpromise.defer();
|
||||
testSubscription = testAddObservable.subscribe(x => {
|
||||
testDeferred.resolve()
|
||||
})
|
||||
smartfile.memory.toFs('HI', './test/assets/hi.txt')
|
||||
await expect(testDeferred.promise).to.eventually.be.fulfilled
|
||||
})
|
||||
testDeferred.resolve();
|
||||
});
|
||||
smartfile.memory.toFs('HI', './test/assets/hi.txt');
|
||||
await expect(testDeferred.promise).to.eventually.be.fulfilled;
|
||||
});
|
||||
|
||||
tap.test('should stop the watch process', async () => {
|
||||
testSmartchok.stop()
|
||||
})
|
||||
testSmartchok.stop();
|
||||
});
|
||||
|
||||
tap.start()
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user