Skip to content

Commit a436a78

Browse files
committed
Add type tests
1 parent dcace32 commit a436a78

File tree

4 files changed

+1765
-170
lines changed

4 files changed

+1765
-170
lines changed

kefir-test-utils.test-d.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {expectType} from 'tsd'
2+
import Kefir from 'kefir'
3+
import {Clock} from 'lolex'
4+
import createHelpers, {Event, Watcher} from '.'
5+
6+
const {VALUE, ERROR, END, value, error, end, withFakeTime, logItem, watch, watchWithTime} = createHelpers(Kefir)
7+
8+
expectType<string>(VALUE)
9+
expectType<string>(ERROR)
10+
expectType<string>(END)
11+
12+
expectType<Event<string, any>>(value('hello'))
13+
expectType<Event<any, string>>(error('hello'))
14+
expectType<Event<any, any>>(end())
15+
16+
expectType<void>(
17+
withFakeTime((tick: (s: number) => void, clock: Clock) => {
18+
tick(10)
19+
clock.runToLast()
20+
})
21+
)
22+
expectType<Event<string, number>>(logItem({type: 'value', value: 'hello'}, false))
23+
expectType<Watcher<string, number>>(watch(new Kefir.Stream<string, number>()))
24+
expectType<Event<string, number>[]>(watchWithTime(new Kefir.Stream<string, number>()))

0 commit comments

Comments
 (0)