BREAKING CHANGE(smartwatch): Introduce Smartwatch: cross-runtime native file watching for Node.js, Deno and Bun; rename smartchok to smartwatch and bump major version to 2.0.0
This commit is contained in:
18
test/test.ts
18
test/test.ts
@@ -1,5 +1,5 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as smartchok from '../ts/index.js';
|
||||
import * as smartwatch from '../ts/index.js';
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartrx from '@push.rocks/smartrx';
|
||||
@@ -11,22 +11,22 @@ if (process.env.CI) {
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
let testSmartchok: smartchok.Smartchok;
|
||||
let testSmartwatch: smartwatch.Smartwatch;
|
||||
let testAddObservable: smartrx.rxjs.Observable<[string, fs.Stats]>;
|
||||
let testSubscription: smartrx.rxjs.Subscription;
|
||||
tap.test('should create a new instance', async () => {
|
||||
testSmartchok = new smartchok.Smartchok([]);
|
||||
expect(testSmartchok).toBeInstanceOf(smartchok.Smartchok);
|
||||
testSmartwatch = new smartwatch.Smartwatch([]);
|
||||
expect(testSmartwatch).toBeInstanceOf(smartwatch.Smartwatch);
|
||||
});
|
||||
|
||||
tap.test('should add some files to watch and start', async () => {
|
||||
testSmartchok.add(['./test/**/*.txt']);
|
||||
await testSmartchok.start()
|
||||
testSmartchok.add(['./test/**/*.md']);
|
||||
testSmartwatch.add(['./test/**/*.txt']);
|
||||
await testSmartwatch.start()
|
||||
testSmartwatch.add(['./test/**/*.md']);
|
||||
});
|
||||
|
||||
tap.test('should get an observable for a certain event', async () => {
|
||||
await testSmartchok.getObservableFor('add').then(async (observableArg) => {
|
||||
await testSmartwatch.getObservableFor('add').then(async (observableArg) => {
|
||||
testAddObservable = observableArg;
|
||||
});
|
||||
});
|
||||
@@ -44,7 +44,7 @@ tap.test('should register an add operation', async () => {
|
||||
|
||||
tap.test('should stop the watch process', async (tools) => {
|
||||
await tools.delayFor(10000);
|
||||
testSmartchok.stop();
|
||||
testSmartwatch.stop();
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
|
||||
Reference in New Issue
Block a user