-
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.
Merge pull request #1 from phryneas/pr/api-bikeshedding
- Loading branch information
Showing
13 changed files
with
298 additions
and
190 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { RenderStream } from "./profile/profile.js"; | ||
|
||
export const assertableSymbol = Symbol.for( | ||
"@testing-library/react-render-stream:assertable" | ||
); | ||
|
||
/** | ||
* A function or object that can be used in assertions, like e.g. | ||
```ts | ||
expect(assertable).toRerender() | ||
expect(assertable).not.toRerender() | ||
expect(assertable).toRenderExactlyTimes(3) | ||
``` | ||
*/ | ||
export type Assertable = { | ||
[assertableSymbol]: RenderStream<any>; | ||
}; | ||
|
||
export function markAssertable<T extends {}>( | ||
assertable: T, | ||
stream: RenderStream<any> | ||
): T & Assertable { | ||
return Object.assign(assertable, { | ||
[assertableSymbol]: stream, | ||
}); | ||
} |
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 type { | ||
NextRenderOptions, | ||
RenderStream, | ||
RenderStreamWithRenderFn, | ||
} from "./profile/profile.js"; | ||
export { | ||
createRenderStream, | ||
useTrackRenders, | ||
WaitForRenderTimeoutError, | ||
} from "./profile/profile.js"; | ||
|
||
export type { SyncScreen } from "./profile/Render.js"; | ||
|
||
export { renderToRenderStream } from "./renderToRenderStream.js"; | ||
export { renderHookToSnapshotStream } from "./renderHookToSnapshotStream.js"; | ||
|
||
export type { Assertable } from "./assertable.js"; |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.