chore: update test template to use nextTestSetup (#62154)

### Why?

Less indentation and allows for IDE integration.



Closes PACK-2523
This commit is contained in:
Leah 2024-02-16 17:30:54 +01:00 committed by GitHub
parent cbdd1d2654
commit ca1b6184c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 92 additions and 100 deletions

View file

@ -1,11 +1,10 @@
import { createNextDescribe } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
createNextDescribe( describe('{{name}}', () => {
'{{name}}', const { next } = nextTestSetup({
{
files: __dirname, files: __dirname,
}, })
({ next }) => {
// Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API. // Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API.
it('should work using cheerio', async () => { it('should work using cheerio', async () => {
const $ = await next.render$('/') const $ = await next.render$('/')
@ -30,5 +29,4 @@ createNextDescribe(
const html = await res.text() const html = await res.text()
expect(html).toContain('hello world') expect(html).toContain('hello world')
}) })
} })
)

View file

@ -1,11 +1,10 @@
import { createNextDescribe } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
createNextDescribe( describe('{{name}}', () => {
'{{name}}', const { next } = nextTestSetup({
{
files: __dirname, files: __dirname,
}, })
({ next }) => {
// Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API. // Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API.
it('should work using cheerio', async () => { it('should work using cheerio', async () => {
const $ = await next.render$('/') const $ = await next.render$('/')
@ -30,5 +29,4 @@ createNextDescribe(
const html = await res.text() const html = await res.text()
expect(html).toContain('hello world') expect(html).toContain('hello world')
}) })
} })
)

View file

@ -1,11 +1,10 @@
import { createNextDescribe } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
createNextDescribe( describe('{{name}}', () => {
'{{name}}', const { next } = nextTestSetup({
{
files: __dirname, files: __dirname,
}, })
({ next }) => {
// Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API. // Recommended for tests that check HTML. Cheerio is a HTML parser that has a jQuery like API.
it('should work using cheerio', async () => { it('should work using cheerio', async () => {
const $ = await next.render$('/') const $ = await next.render$('/')
@ -30,5 +29,4 @@ createNextDescribe(
const html = await res.text() const html = await res.text()
expect(html).toContain('hello world') expect(html).toContain('hello world')
}) })
} })
)

View file

@ -1,14 +1,12 @@
import { createNextDescribe } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
createNextDescribe( describe('nextTestSetup', () => {
'createNextDescribe', const { next } = nextTestSetup({
{
files: __dirname, files: __dirname,
}, })
({ next }) => {
it('should work', async () => { it('should work', async () => {
const res = await next.fetch('/') const res = await next.fetch('/')
expect(await res.text()).toContain('Hello World') expect(await res.text()).toContain('Hello World')
}) })
} })
)

View file

@ -6394,7 +6394,7 @@
"runtimeError": false "runtimeError": false
}, },
"test/e2e/test-utils-tests/basic/basic.test.ts": { "test/e2e/test-utils-tests/basic/basic.test.ts": {
"passed": ["createNextDescribe should work"], "passed": ["nextTestSetup should work"],
"failed": [], "failed": [],
"pending": [], "pending": [],
"flakey": [], "flakey": [],