-
Notifications
You must be signed in to change notification settings - Fork 35
/
index.spec.ts
34 lines (31 loc) · 945 Bytes
/
index.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import fs from 'fs'
import build from '~/aspida/src/buildTemplate'
describe('cli test', () => {
test('main', () => {
const paths = [
{
input: 'packages/aspida/__tests__/apis',
resultDirPath: 'packages/aspida/__tests__/apis'
},
{
input: './packages/aspida/__tests__/apis',
resultDirPath: 'packages/aspida/__tests__/apis'
},
{
input: './packages/aspida/__tests__/apis/',
resultDirPath: 'packages/aspida/__tests__/apis'
},
{
input: 'packages/aspida/__tests__/apis/',
resultDirPath: 'packages/aspida/__tests__/apis'
}
]
paths.forEach(({ input, resultDirPath }) => {
const resultFilePath = `${resultDirPath}/$api.ts`
const result = fs.readFileSync(resultFilePath, 'utf8')
const { text, filePath } = build(input)
expect(text).toBe(result)
expect(filePath).toBe(resultFilePath)
})
})
})