Skip to content

Commit

Permalink
all tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Nov 27, 2024
1 parent 5ff5420 commit c124751
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
24 changes: 12 additions & 12 deletions src/expect/__tests__/renderStreamMatchers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('toRerender', () => {
test('basic functionality', async () => {
const {takeRender, render} = createRenderStream({})

render(<RerenderingComponent />)
await render(<RerenderingComponent />)
await expect(takeRender).toRerender()
await takeRender()

Expand All @@ -48,7 +48,7 @@ describe('toRerender', () => {
test('works with renderStream object', async () => {
const renderStream = createRenderStream({})

renderStream.render(<RerenderingComponent />)
await renderStream.render(<RerenderingComponent />)
await expect(renderStream).toRerender()
await renderStream.takeRender()

Expand All @@ -60,7 +60,7 @@ describe('toRerender', () => {
})

test('works with takeSnapshot function', async () => {
const {takeSnapshot} = renderHookToSnapshotStream(() => useRerender())
const {takeSnapshot} = await renderHookToSnapshotStream(() => useRerender())

await expect(takeSnapshot).toRerender()
await takeSnapshot()
Expand All @@ -73,7 +73,7 @@ describe('toRerender', () => {
})

test('works with snapshotStream', async () => {
const snapshotStream = renderHookToSnapshotStream(() => useRerender())
const snapshotStream = await renderHookToSnapshotStream(() => useRerender())

await expect(snapshotStream).toRerender()
await snapshotStream.takeSnapshot()
Expand All @@ -88,7 +88,7 @@ describe('toRerender', () => {
test("errors when it rerenders, but shouldn't", async () => {
const {takeRender, render} = createRenderStream({})

render(<RerenderingComponent />)
await render(<RerenderingComponent />)
await expect(takeRender).toRerender()
await takeRender()

Expand All @@ -106,7 +106,7 @@ Expected component to not rerender, but it did.
test("errors when it should rerender, but doesn't", async () => {
const {takeRender, render} = createRenderStream({})

render(<RerenderingComponent />)
await render(<RerenderingComponent />)
await expect(takeRender).toRerender()
await takeRender()

Expand All @@ -123,7 +123,7 @@ describe('toRenderExactlyTimes', () => {
test('basic functionality', async () => {
const {takeRender, render} = createRenderStream({})

render(<RerenderingComponent />)
await render(<RerenderingComponent />)
testEvents.emit('rerender')

await expect(takeRender).toRenderExactlyTimes(2)
Expand All @@ -132,21 +132,21 @@ describe('toRenderExactlyTimes', () => {
test('works with renderStream object', async () => {
const renderStream = createRenderStream({})

renderStream.render(<RerenderingComponent />)
await renderStream.render(<RerenderingComponent />)
testEvents.emit('rerender')

await expect(renderStream).toRenderExactlyTimes(2)
})

test('works with takeSnapshot function', async () => {
const {takeSnapshot} = renderHookToSnapshotStream(() => useRerender())
const {takeSnapshot} = await renderHookToSnapshotStream(() => useRerender())
testEvents.emit('rerender')

await expect(takeSnapshot).toRenderExactlyTimes(2)
})

test('works with snapshotStream', async () => {
const snapshotStream = renderHookToSnapshotStream(() => useRerender())
const snapshotStream = await renderHookToSnapshotStream(() => useRerender())
testEvents.emit('rerender')

await expect(snapshotStream).toRenderExactlyTimes(2)
Expand All @@ -155,7 +155,7 @@ describe('toRenderExactlyTimes', () => {
test('errors when the count of rerenders is wrong', async () => {
const {takeRender, render} = createRenderStream({})

render(<RerenderingComponent />)
await render(<RerenderingComponent />)
testEvents.emit('rerender')

const error = await getExpectErrorMessage(
Expand All @@ -172,7 +172,7 @@ It rendered 2 times.
test('errors when the count of rerenders is right (inverted)', async () => {
const {takeRender, render} = createRenderStream({})

render(<RerenderingComponent />)
await render(<RerenderingComponent />)
testEvents.emit('rerender')

const error = await getExpectErrorMessage(
Expand Down
10 changes: 5 additions & 5 deletions src/renderStream/__tests__/useTrackRenders.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('non-suspense use cases', () => {

test('basic functionality', async () => {
const {takeRender, render} = createRenderStream()
render(<App />)
await render(<App />)
asyncAction.resolve('data')
{
const {renderedComponents} = await takeRender()
Expand All @@ -75,7 +75,7 @@ describe('non-suspense use cases', () => {

test('error path', async () => {
const {takeRender, render} = createRenderStream()
render(<App />)
await render(<App />)
asyncAction.reject(new Error('error'))
{
const {renderedComponents} = await takeRender()
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('suspense use cases', () => {

test('basic functionality', async () => {
const {takeRender, render} = createRenderStream()
render(<App />)
await render(<App />)
asyncAction.resolve('data')
{
const {renderedComponents} = await takeRender()
Expand All @@ -133,7 +133,7 @@ describe('suspense use cases', () => {

test('ErrorBoundary', async () => {
const {takeRender, render} = createRenderStream()
render(<App />)
await render(<App />)

const spy = jest.spyOn(console, 'error')
spy.mockImplementation(() => {})
Expand All @@ -156,7 +156,7 @@ test('specifying the `name` option', async () => {
return <>{children}</>
}
const {takeRender, render} = createRenderStream()
render(
await render(
<>
<NamedComponent name="Darth Vader">
<NamedComponent name="Luke">
Expand Down

0 comments on commit c124751

Please sign in to comment.