Download next.js/test/e2e/example.txt from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/example.txt
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/e2e/example.txt
-
curl -L -o example.txt https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/e2e/example.txt
1.01 kB
| import { nextTestSetup } from 'e2e-utils' | |
| describe('{{name}}', () => { | |
| const { next } = nextTestSetup({ | |
| files: __dirname, | |
| }) | |
| // Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API. | |
| it('should work using cheerio', async () => { | |
| const $ = await next.render$('/') | |
| expect($('p').text()).toBe('hello world') | |
| }) | |
| // Recommended for tests that need a full browser | |
| it('should work using browser', async () => { | |
| const browser = await next.browser('/') | |
| expect(await browser.elementByCss('p').text()).toBe('hello world') | |
| }) | |
| // In case you need the full HTML. Can also use $.html() with cheerio. | |
| it('should work with html', async () => { | |
| const html = await next.render('/') | |
| expect(html).toContain('hello world') | |
| }) | |
| // In case you need to test the response object | |
| it('should work with fetch', async () => { | |
| const res = await next.fetch('/') | |
| const html = await res.text() | |
| expect(html).toContain('hello world') | |
| }) | |
| }) | |