Skip to content

Commit

Permalink
refactor: return a Promise instead of relying on callback parameter (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
darekkay authored Oct 4, 2020
1 parent f1d576f commit d44b70a
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/init/__tests__/add-contributors-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,24 @@ test('create contributors section if content is empty', () => {
expect(result).toMatchSnapshot()
})

test('README exists', done => {
const file = 'README.md'
ensureFileExists(file)
.then(data => expect(data).toStrictEqual(file))
.then(_ => done())
test('README exists', () => {
return new Promise(done => {
const file = 'README.md'
ensureFileExists(file)
.then(data => expect(data).toStrictEqual(file))
.then(_ => done())
})
})

test("LOREM doesn't exists", done => {
const file = 'LOREM.md'
ensureFileExists(file).then(data => {
expect(data).toStrictEqual(file)
return unlink(file, err => {
if (err) throw err
done()
test("LOREM doesn't exists", () => {
return new Promise(done => {
const file = 'LOREM.md'
ensureFileExists(file).then(data => {
expect(data).toStrictEqual(file)
return unlink(file, err => {
if (err) throw err
done()
})
})
})
})

0 comments on commit d44b70a

Please sign in to comment.