smartrx/test/test.observableintake.both.ts

39 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-07-12 08:57:25 +00:00
import { tap, expect } from '@push.rocks/tapbundle';
2017-11-01 13:59:28 +00:00
2022-08-05 10:50:37 +00:00
import * as smartrx from '../ts/index.js';
2017-11-01 13:59:28 +00:00
tap.test('should create a valid instance of observableinstake', async () => {
const testObservableIntake = new smartrx.ObservableIntake();
2022-01-24 02:44:13 +00:00
expect(testObservableIntake).toBeInstanceOf(smartrx.ObservableIntake);
});
2017-11-01 13:59:28 +00:00
2020-07-12 01:53:32 +00:00
tap.test('expect testObserservableIntake to push things', async (tools) => {
const testObserservableIntake = new smartrx.ObservableIntake();
2022-01-24 02:44:13 +00:00
testObserservableIntake.subscribe((value: any) => {
console.log(value);
});
testObserservableIntake.push('hi');
testObserservableIntake.push('wow');
testObserservableIntake.signalComplete();
await testObserservableIntake.completed;
});
2020-07-12 01:53:32 +00:00
tap.test('expect testObserservableIntake to push things', async (tools) => {
const testObserservableIntake = new smartrx.ObservableIntake();
testObserservableIntake.push('hi');
testObserservableIntake.push('wow');
testObserservableIntake.makeBuffered();
testObserservableIntake.push('jo');
2022-01-24 02:44:13 +00:00
testObserservableIntake.subscribe((value: any) => {
console.log(value);
testObserservableIntake.signalComplete();
});
testObserservableIntake.request(1);
await testObserservableIntake.completed;
});
2017-11-01 16:01:30 +00:00
tap.test('', async () => {});
2017-11-01 16:01:30 +00:00
tap.start();