-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
47 lines (42 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const {mock} = require('gogen')
const directory = 'dist'
const answers = {
description: 'superb',
devDeps: [],
}
describe('template', () => {
it('creates with defaults', async () => {
const {files, readFile} = await mock('.', directory, {
answers,
})
expect(files).toMatchSnapshot()
expect(JSON.parse(readFile('package.json'))).toMatchSnapshot()
})
it('creates with jest', async () => {
const {readFile} = await mock('.', directory, {
answers: {
...answers,
devDeps: ['jest'],
},
})
expect(JSON.parse(readFile('package.json'))).toMatchSnapshot()
})
it('creates with recommended', async () => {
const {readFile} = await mock('.', directory, {
answers: {
...answers,
devDeps: ['recommended'],
},
})
expect(JSON.parse(readFile('package.json'))).toMatchSnapshot()
})
it('creates with recommended & jest', async () => {
const {readFile} = await mock('.', directory, {
answers: {
...answers,
devDeps: ['recommended', 'jest'],
},
})
expect(JSON.parse(readFile('package.json'))).toMatchSnapshot()
})
})