Skip to content

Commit

Permalink
test: assert for typescript template dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed May 18, 2021
1 parent 78b1735 commit d531530
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/integration/create-next-app/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ describe('create next app', () => {
const res = await run([projectName, '--typescript'], { cwd })
expect(res.exitCode).toBe(0)

expect(
fs.existsSync(path.join(cwd, projectName, 'package.json'))
).toBeTruthy()
const pkgJSONPath = path.join(cwd, projectName, 'package.json')

expect(fs.existsSync(pkgJSONPath)).toBeTruthy()
expect(
fs.existsSync(path.join(cwd, projectName, 'pages/index.tsx'))
).toBeTruthy()
Expand All @@ -119,6 +119,14 @@ describe('create next app', () => {
expect(
fs.existsSync(path.join(cwd, projectName, '.gitignore'))
).toBeTruthy()

// Assert for dependencies specific to the typescript template
const dependencies = ['next', 'react', 'react-dom']
const devDependencies = ['@types/react', 'typescript']

const pkgJSON = require(pkgJSONPath)
expect(Object.keys(pkgJSON.dependencies)).toEqual(dependencies)
expect(Object.keys(pkgJSON.devDependencies)).toEqual(devDependencies)
})
})

Expand Down

0 comments on commit d531530

Please sign in to comment.