-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
61 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export async function processLogic({process, processOptions}, deps) { | ||
const dispatchReturn = | ||
'dispatchReturn' in processOptions | ||
? processOptions.dispatchReturn | ||
: process.length === 1; | ||
|
||
const dispatch = jest.fn(); | ||
if (dispatchReturn) { | ||
const actionToDispatch = await process(deps); | ||
dispatch(actionToDispatch); | ||
} else { | ||
await new Promise(resolve => { | ||
process(deps, dispatch, resolve); | ||
}); | ||
} | ||
return dispatch; | ||
} |
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
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,15 +1,14 @@ | ||
import unlinkGithubIdentity from '../unlinkGithubIdentity'; | ||
|
||
import {unlinkGithub} from '../../clients/firebase'; | ||
import {identityUnlinked} from '../../actions/user'; | ||
|
||
import {processLogic} from './helpers'; | ||
|
||
jest.mock('../../clients/firebase'); | ||
|
||
test('should unlink Github Identity', async () => { | ||
const { | ||
type, | ||
payload: {providerId}, | ||
} = await unlinkGithubIdentity.process(); | ||
const dispatch = await processLogic(unlinkGithubIdentity); | ||
expect(unlinkGithub).toHaveBeenCalledWith(); | ||
expect(type).toBe('IDENTITY_UNLINKED'); | ||
expect(providerId).toBe('github.com'); | ||
expect(dispatch).toHaveBeenCalledWith(identityUnlinked('github.com')); | ||
}); |
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