-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
executable file
·24 lines (21 loc) · 1.13 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const tap = require('tap')
const header = require('./App')
const { readFileSync } = require('fs')
const { resolve } = require('path')
const readjs = readFileSync(resolve('./test/test.js'), 'utf8')
const readts = readFileSync(resolve('./test/test.ts'), 'utf8')
const output = readFileSync(resolve('./test/output'), 'utf8')
tap.test('Error test', async ({ throws }) => {
throws(() => header(), new Error('Please enter valid path array'))
throws(() => header([]), new Error('Please enter valid path array'))
throws(() => header(['']), new Error('Please enter valid path array'))
throws(() => header(['./test/']), new Error('Please enter valid path array'))
throws(() => header(['./test/tst.js']), new Error('Please enter valid path array'))
throws(() => header(['./test/test.js'], {}), new Error('Please enter valid json data'))
throws(() => header(['./test/test.js'], { name: '', version: '', description: '', author: '', license: '', homepage: '' }), new Error('Please enter valid json data'))
})
tap.test('Output test', ({ equal, end }) => {
equal(readts.includes(output) && readjs.includes(output), true)
end()
})
// add keywords