1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Remove unused vars and fix typo. (#5752)

- Removed unused "render" and "appPort" var from tests
- Fix typo on "occured" to "occurred"
This commit is contained in:
Anderson Leite 2018-11-27 03:28:34 -08:00 committed by Tim Neutkens
parent 9d30e411b5
commit 48d3ae2dd6
8 changed files with 10 additions and 10 deletions

View file

@ -47,7 +47,7 @@ const RegisterBox = ({ client }) => {
name.value = email.value = password.value = '' name.value = email.value = password.value = ''
}}> }}>
{error && <p>Issue occured while registering :(</p>} {error && <p>Issue occurred while registering :(</p>}
<input name='name' placeholder='Name' ref={node => { name = node }} /><br /> <input name='name' placeholder='Name' ref={node => { name = node }} /><br />
<input name='email' placeholder='Email' ref={node => { email = node }} /><br /> <input name='email' placeholder='Email' ref={node => { email = node }} /><br />
<input name='password' placeholder='Password' ref={node => { password = node }} type='password' /><br /> <input name='password' placeholder='Password' ref={node => { password = node }} type='password' /><br />

View file

@ -1,5 +1,5 @@
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
throw new Error('An Expected error occured') throw new Error('An Expected error occurred')
} }
export default () => <div /> export default () => <div />

View file

@ -2,7 +2,7 @@ import React from 'react'
export default class ErrorInRenderPage extends React.Component { export default class ErrorInRenderPage extends React.Component {
render () { render () {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
throw new Error('An Expected error occured') throw new Error('An Expected error occurred')
} }
return <div /> return <div />
} }

View file

@ -3,7 +3,7 @@
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
import {waitFor, getReactErrorOverlayContent} from 'next-test-utils' import {waitFor, getReactErrorOverlayContent} from 'next-test-utils'
export default (context, render) => { export default (context) => {
describe('Client Navigation', () => { describe('Client Navigation', () => {
describe('with <Link/>', () => { describe('with <Link/>', () => {
it('should navigate the page', async () => { it('should navigate the page', async () => {
@ -664,7 +664,7 @@ export default (context, render) => {
browser = await webdriver(context.appPort, '/error-inside-browser-page') browser = await webdriver(context.appPort, '/error-inside-browser-page')
await waitFor(3000) await waitFor(3000)
const text = await getReactErrorOverlayContent(browser) const text = await getReactErrorOverlayContent(browser)
expect(text).toMatch(/An Expected error occured/) expect(text).toMatch(/An Expected error occurred/)
expect(text).toMatch(/pages\/error-inside-browser-page\.js:5/) expect(text).toMatch(/pages\/error-inside-browser-page\.js:5/)
} finally { } finally {
if (browser) { if (browser) {
@ -679,7 +679,7 @@ export default (context, render) => {
browser = await webdriver(context.appPort, '/error-in-the-browser-global-scope') browser = await webdriver(context.appPort, '/error-in-the-browser-global-scope')
await waitFor(3000) await waitFor(3000)
const text = await getReactErrorOverlayContent(browser) const text = await getReactErrorOverlayContent(browser)
expect(text).toMatch(/An Expected error occured/) expect(text).toMatch(/An Expected error occurred/)
expect(text).toMatch(/error-in-the-browser-global-scope\.js:2/) expect(text).toMatch(/error-in-the-browser-global-scope\.js:2/)
} finally { } finally {
if (browser) { if (browser) {

View file

@ -3,7 +3,7 @@ import webdriver from 'next-webdriver'
import { join } from 'path' import { join } from 'path'
import { check, File, waitFor, getReactErrorOverlayContent, getBrowserBodyText } from 'next-test-utils' import { check, File, waitFor, getReactErrorOverlayContent, getBrowserBodyText } from 'next-test-utils'
export default (context, render) => { export default (context) => {
describe('Error Recovery', () => { describe('Error Recovery', () => {
it('should recover from 404 after a page has been added', async () => { it('should recover from 404 after a page has been added', async () => {
let browser let browser

View file

@ -1,7 +1,7 @@
/* eslint-env jest */ /* eslint-env jest */
import webdriver from 'next-webdriver' import webdriver from 'next-webdriver'
export default (context, render) => { export default (context) => {
describe('process.env', () => { describe('process.env', () => {
it('should set process.env.NODE_ENV in development', async () => { it('should set process.env.NODE_ENV in development', async () => {
const browser = await webdriver(context.appPort, '/process-env') const browser = await webdriver(context.appPort, '/process-env')

View file

@ -4,7 +4,7 @@ import cheerio from 'cheerio'
import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants' import {BUILD_MANIFEST, REACT_LOADABLE_MANIFEST} from 'next-server/constants'
import { join } from 'path' import { join } from 'path'
export default function ({ app }, suiteName, render, fetch, appPort) { export default function ({ app }, suiteName, render, fetch) {
async function get$ (path, query) { async function get$ (path, query) {
const html = await render(path, query) const html = await render(path, query)
return cheerio.load(html) return cheerio.load(html)

View file

@ -2,7 +2,7 @@ import React from 'react'
export default class ErrorInRenderPage extends React.Component { export default class ErrorInRenderPage extends React.Component {
render () { render () {
if (typeof window !== 'undefined') { if (typeof window !== 'undefined') {
const error = new Error('An Expected error occured') const error = new Error('An Expected error occurred')
// This will be extracted by getInitialProps in the _error page, // This will be extracted by getInitialProps in the _error page,
// which will result in a different error message being rendered. // which will result in a different error message being rendered.
error.statusCode = 404 error.statusCode = 404