-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate mockAction, clean up namespace tests.
Should have been two commits
- Loading branch information
Showing
5 changed files
with
126 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,13 @@ | ||
import { ActionWithPayload, ActionWithoutPayload } from 'types/Action'; | ||
import { Action } from 'rxbeach'; | ||
import { VoidPayload } from 'rxbeach/internal'; | ||
|
||
export const actionWithoutPayload = ( | ||
export const mockAction = <P = VoidPayload>( | ||
type: string, | ||
namespace?: string | ||
): ActionWithoutPayload => ({ | ||
meta: { namespace }, | ||
type, | ||
}); | ||
|
||
export const actionWithPayload = <P>( | ||
type: string, | ||
payload: P, | ||
namespace?: string | ||
): ActionWithPayload<P> => ({ | ||
...actionWithoutPayload(type, namespace), | ||
payload, | ||
}); | ||
namespace?: string, | ||
payload?: P | ||
): Action<P> => | ||
({ | ||
meta: { namespace }, | ||
type, | ||
payload, | ||
} as Action<P>); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters