Skip to content

Commit 4c91bbb

Browse files
committed
01/01: add instructions to the problem
1 parent 3660fdd commit 4c91bbb

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import { it, expect } from 'vitest'
22
import { render, screen } from '@testing-library/react'
3-
import { FilePreview } from './file-preview.tsx'
43

54
it('displays the preview card', async () => {
6-
render(<FilePreview file={new File(['hello world'], 'message.txt')} />)
7-
8-
expect(screen.getByText('message.txt')).toBeTruthy()
9-
expect(screen.getByText('hello world')).toBeTruthy()
5+
// 🐨 Render the `FilePreview` component.
6+
// 💰 render(<MyComponent />)
7+
// Provide a new `File` instance as the value of the `file` prop.
8+
// 💰 new File(['hello world'], 'file.txt')
9+
//
10+
// 🐨 Write an assertion that expects the file name to be present
11+
// in the DOM (you can use `.toBeTruthy()` for now).
12+
// 💰 screen.getByText(expectedText)
13+
//
14+
// 🐨 Similarly, write another assertion that expects
15+
// the file contents to be present in the DOM.
1016
})

exercises/01.sunsetting-jsdom/01.solution.break-jsdom/src/file-preview.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { render, screen } from '@testing-library/react'
33
import { FilePreview } from './file-preview.tsx'
44

55
it('displays the preview card', async () => {
6-
render(<FilePreview file={new File(['hello world'], 'message.txt')} />)
6+
render(<FilePreview file={new File(['hello world'], 'file.txt')} />)
77

8-
expect(screen.getByText('message.txt')).toBeTruthy()
8+
expect(screen.getByText('file.txt')).toBeTruthy()
99
expect(screen.getByText('hello world')).toBeTruthy()
1010
})

0 commit comments

Comments
 (0)