38 lines
3.1 KiB
JavaScript
38 lines
3.1 KiB
JavaScript
"use strict";
|
|
require("typings-test");
|
|
const should = require("should");
|
|
const smartfile = require("smartfile");
|
|
const smartchok = require("../dist/index");
|
|
describe('smartchok', function () {
|
|
let testSmartchok;
|
|
let testAddObservable;
|
|
let testSubscription;
|
|
it('should create a new instance', function () {
|
|
testSmartchok = new smartchok.Smartchok([]);
|
|
should(testSmartchok).be.instanceof(smartchok.Smartchok);
|
|
});
|
|
it('should add some files to watch and start', function (done) {
|
|
testSmartchok.add(['./test/assets/**/*.txt']);
|
|
testSmartchok.start().then(() => {
|
|
testSmartchok.add(['./test/assets/**/*.md']);
|
|
done();
|
|
}).catch(err => { console.log(err); });
|
|
});
|
|
it('should get an observable for a certain event', function (done) {
|
|
testSmartchok.getObservableFor('add').then((observableArg) => {
|
|
testAddObservable = observableArg;
|
|
done();
|
|
}).catch(err => { console.log(err); });
|
|
});
|
|
it('should register an add operation', function (done) {
|
|
this.timeout(5000);
|
|
testSubscription = testAddObservable.subscribe(x => {
|
|
done();
|
|
});
|
|
smartfile.memory.toFs('HI', './test/assets/hi.txt');
|
|
});
|
|
it('should stop the watch process', function () {
|
|
testSmartchok.stop();
|
|
});
|
|
});
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFDaEMsdUNBQXNDO0FBRXRDLDJDQUEwQztBQUUxQyxRQUFRLENBQUMsV0FBVyxFQUFDO0lBQ2pCLElBQUksYUFBa0MsQ0FBQTtJQUN0QyxJQUFJLGlCQUFxQyxDQUFBO0lBQ3pDLElBQUksZ0JBQWlDLENBQUE7SUFDckMsRUFBRSxDQUFDLDhCQUE4QixFQUFDO1FBQzlCLGFBQWEsR0FBRyxJQUFJ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