Skip to content

Commit

Permalink
fix: index.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed May 29, 2020
1 parent 851ecd3 commit cd3fd36
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ import fs from 'fs'
import build from '../src/buildTemplate'
import getConfig from '../src/getConfig'

const basePath = 'packages/pathpida'

describe('cli test', () => {
test('main', () => {
const { input, output, baseURL, trailingSlash } = getConfig(`${basePath}/pathpida.config.js`)[0]
const inputDir = `${basePath}/${input}`
const outputDir = `${basePath}/${output}`
const { input, output, baseURL, trailingSlash } = getConfig()[0]

const resultFilePath = `${outputDir}$path.ts`
const result = fs.readFileSync(resultFilePath, 'utf8')
const { filePath, text } = build({ input: inputDir, output: outputDir, baseURL, trailingSlash })
const result = fs.readFileSync('$path.ts', 'utf8')
const { filePath, text } = build({ input, output, baseURL, trailingSlash })

expect(filePath).toBe(resultFilePath)
expect(filePath).toBe('$path.ts')
expect(text).toBe(result)
})
})

0 comments on commit cd3fd36

Please sign in to comment.