initial
This commit is contained in:
1
test/assets/hi.txt
Normal file
1
test/assets/hi.txt
Normal file
@ -0,0 +1 @@
|
||||
HI
|
1
test/assets/test1.txt
Normal file
1
test/assets/test1.txt
Normal file
@ -0,0 +1 @@
|
||||
# This is a textfile that will be cloned
|
1
test/test.d.ts
vendored
Normal file
1
test/test.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
import 'typings-test';
|
35
test/test.js
Normal file
35
test/test.js
Normal file
@ -0,0 +1,35 @@
|
||||
"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(() => { 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHdCQUFxQjtBQUNyQixpQ0FBZ0M7QUFD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FBRyxDQUFDLENBQUEsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUN6QyxDQUFDLENBQUMsQ0FBQTtJQUNGLEVBQUUsQ0FBQyxrQ0FBa0MsRUFBQyxVQUFTLElBQUk7UUFDL0MsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUNsQixnQkFBZ0IsR0FBRyxpQkFBaUIsQ0FBQyxTQUFTLENBQUMsQ0FBQztZQUM1QyxJQUFJLEVBQUUsQ0FBQTtRQUNWLENBQUMsQ0FBQyxDQUFBO1FBQ0YsU0FBUyxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFDLHNCQUFzQixDQUFDLENBQUE7SUFDdEQsQ0FBQyxDQUFDLENBQUE7SUFDRixFQUFFLENBQUMsK0JBQStCLEVBQUM7UUFDL0IsYUFBYSxDQUFDLElBQUksRUFBRSxDQUFBO0lBQ3hCLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyxDQUFDLENBQUEifQ==
|
35
test/test.ts
Normal file
35
test/test.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import 'typings-test'
|
||||
import * as should from 'should'
|
||||
import * as smartfile from 'smartfile'
|
||||
import * as rx from 'rxjs/Rx'
|
||||
import * as smartchok from '../dist/index'
|
||||
|
||||
describe('smartchok',function(){
|
||||
let testSmartchok: smartchok.Smartchok
|
||||
let testAddObservable: rx.Observable<any>
|
||||
let testSubscription: rx.Subscription
|
||||
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(() => { 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()
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user