-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
1 parent
ede24c9
commit 8cff5a9
Showing
3 changed files
with
53 additions
and
0 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,24 @@ | ||
import { expect, testStep, dtl } from '@epic-web/workshop-utils/test' | ||
|
||
const originalError = console.error | ||
const errors: Array<string> = [] | ||
console.error = (...args: any[]) => { | ||
errors.push(args[0]) | ||
originalError(...args) | ||
} | ||
|
||
import './index.tsx' | ||
|
||
const { screen } = dtl | ||
|
||
await testStep('Wait for Add Item button', async () => { | ||
await screen.findByRole('button', { name: /add item/i }) | ||
}) | ||
|
||
await testStep('Key prop is provided (no console errors)', async () => { | ||
try { | ||
expect(errors).toHaveLength(0) | ||
} finally { | ||
console.error = originalError | ||
} | ||
}) |
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,24 @@ | ||
import { expect, testStep, dtl } from '@epic-web/workshop-utils/test' | ||
|
||
const originalError = console.error | ||
const errors: Array<string> = [] | ||
console.error = (...args: any[]) => { | ||
errors.push(args[0]) | ||
originalError(...args) | ||
} | ||
|
||
import './index.tsx' | ||
|
||
const { screen } = dtl | ||
|
||
await testStep('Wait for things to render', async () => { | ||
await screen.findByText('Without a key') | ||
}) | ||
|
||
await testStep('Key prop is provided (no console errors)', async () => { | ||
try { | ||
expect(errors).toHaveLength(0) | ||
} finally { | ||
console.error = originalError | ||
} | ||
}) |
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,5 @@ | ||
import { expect, testStep } from '@epic-web/workshop-utils/test' | ||
|
||
await testStep('this is just a demo', () => { | ||
expect(true).toBe(true) | ||
}) |