-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for @testing-library/react
- Reorganizes Makefile and npm scripts - Re-implements useRecurly tests
- Loading branch information
1 parent
3c1af37
commit 35c228f
Showing
6 changed files
with
63 additions
and
30 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
File renamed without changes.
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,40 @@ | ||
import React from 'react'; | ||
import { RecurlyProvider, Elements } from '../../lib'; | ||
|
||
/** | ||
* This method deactivates the virtual console error method. | ||
* Useful when we expect a test to produce errors. | ||
*/ | ||
export function suppressConsoleErrors () { | ||
beforeEach(() => { | ||
jest.spyOn(console, 'error').mockImplementation(); | ||
}); | ||
|
||
afterEach(() => { | ||
console.error.mockRestore(); | ||
}); | ||
} | ||
|
||
/** | ||
* Wraps arbitrary react components in a valid RecurlyProvider | ||
*/ | ||
export function withRecurlyProvider (children) { | ||
const api = `http://localhost:${process.env.PORT || 9877}`; | ||
|
||
return ( | ||
<RecurlyProvider publicKey="test-public-key" api={api}> | ||
{children} | ||
</RecurlyProvider> | ||
); | ||
} | ||
|
||
/** | ||
* Wraps arbitrary react components in a valid Elements and RecurlyProvider | ||
*/ | ||
export function withElements (children) { | ||
return withRecurlyProvider( | ||
<Elements> | ||
{children} | ||
</Elements> | ||
); | ||
} |
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