Skip to content

Commit

Permalink
test: cover test case of actions with different signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
sisisin committed Aug 8, 2020
1 parent 4aef000 commit 12da660
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions packages/typeless-router/i.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
console.log(require('typeless'))
console.log(require.main)
12 changes: 6 additions & 6 deletions packages/typeless/__tests__/type/Epic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ function createAction<T extends ActionMap>(acts: T) {
return createModule(Symbol('test')).withActions(acts)[1];
}
TT.describe('onMany', () => {
const m1 = createAction({ foo: () => ({ payload: 1 }) });
const m2 = createAction({ foo: () => ({ payload: true }) });
const m1 = createAction({ foo: (num: number) => ({ payload: { num } }) });
const m2 = createAction({ foo: (boo: boolean) => ({ payload: { boo } }) });
const m3 = createAction({ foo: () => ({ payload: 'bar' }) });
const m4 = createAction({ foo: () => ({ payload: Symbol('baz') }) });
const m5 = createAction({ foo: () => ({ payload: { obj: 'foo' } }) });
const m5 = createAction({ foo: (str: string) => ({ payload: { str } }) });
const m6 = createAction({ foo: () => ({ payload: ['array'] }) });

TT.describe('should error called with', () => {
Expand All @@ -27,11 +27,11 @@ TT.describe('onMany', () => {
TT.it('called with many arguments', () => {
new Epic().onMany([m1.foo, m2.foo, m3.foo, m4.foo, m5.foo, m6.foo], p => {
type Expected =
| number
| boolean
| { num: number }
| { boo: boolean }
| string
| symbol
| { obj: string }
| { str: string }
| string[];
TT.assert<TT.Eq<typeof p, Expected>>();

Expand Down

0 comments on commit 12da660

Please sign in to comment.