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 81ca2f7 commit 86d96f4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions __tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@ import fs from 'fs'
import getConfig from '../src/getConfig'
import buildFromScript from '../src'

const basePath = 'packages/openapi2aspida'

describe('cli test', () => {
beforeAll(() => fs.mkdirSync(`${basePath}/_samples`))
afterAll(fn => fs.rmdir(`${basePath}/_samples`, { recursive: true }, fn))
beforeAll(() => fs.mkdirSync('_samples'))
afterAll(fn => fs.rmdir('_samples', { recursive: true }, fn))

test('main', () => {
const configs = getConfig(`${basePath}/aspida.config.js`)
const configs = getConfig('aspida.config.js')

return Promise.all(
configs.map(async config => {
const outputDir = `${basePath}/_${config.output}`
const outputDir = `_${config.output}`
await buildFromScript({
...config,
input: `${basePath}/${config.input}`,
input: config.input,
output: outputDir
})

expect(fs.readFileSync(`${outputDir}/$api.ts`, 'utf8')).toBe(
fs.readFileSync(`${basePath}/${config.output}/$api.ts`, 'utf8')
fs.readFileSync(`${config.output}/$api.ts`, 'utf8')
)
})
)
Expand Down

0 comments on commit 86d96f4

Please sign in to comment.