Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leaysgur committed Sep 21, 2020
1 parent c0c6929 commit 14f2673
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default () => <p>I am a home page</p>
36 changes: 36 additions & 0 deletions test/integration/export-progress-status-message/test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* eslint-env jest */

import { join } from 'path'
import { nextBuild, nextExportDefault } from 'next-test-utils'

jest.setTimeout(1000 * 60 * 5)
const appDir = join(__dirname, '../')

describe('Export cli prints progress info', () => {
let buildStdout
let exportStdout
beforeAll(async () => {
const buildResult = await nextBuild(appDir, [], { stdout: true })
buildStdout = buildResult.stdout
const exportResult = await nextExportDefault(appDir, { stdout: true })
exportStdout = exportResult.stdout
})

it('build: should log with internally passed statusMessage', async () => {
const lines = buildStdout.split('\n')
// Search `info - Generating static pages (n/m)` line
const found = lines.some((line) =>
/Generating static pages \(\d+\/\d+\)/.test(line)
)

expect(found).toBeTruthy()
})

it('export: should log with default label', async () => {
const lines = exportStdout.split('\n')
// Search `info - Exporting (n/m)` line
const found = lines.some((line) => /Exporting \(\d+\/\d+\)/.test(line))

expect(found).toBeTruthy()
})
})

0 comments on commit 14f2673

Please sign in to comment.