mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
refactor: return a Promise instead of relying on callback parameter (#289)
This commit is contained in:
parent
f1d576fda7
commit
d44b70a1f0
1 changed files with 16 additions and 12 deletions
|
@ -30,20 +30,24 @@ test('create contributors section if content is empty', () => {
|
||||||
expect(result).toMatchSnapshot()
|
expect(result).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('README exists', done => {
|
test('README exists', () => {
|
||||||
const file = 'README.md'
|
return new Promise(done => {
|
||||||
ensureFileExists(file)
|
const file = 'README.md'
|
||||||
.then(data => expect(data).toStrictEqual(file))
|
ensureFileExists(file)
|
||||||
.then(_ => done())
|
.then(data => expect(data).toStrictEqual(file))
|
||||||
|
.then(_ => done())
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test("LOREM doesn't exists", done => {
|
test("LOREM doesn't exists", () => {
|
||||||
const file = 'LOREM.md'
|
return new Promise(done => {
|
||||||
ensureFileExists(file).then(data => {
|
const file = 'LOREM.md'
|
||||||
expect(data).toStrictEqual(file)
|
ensureFileExists(file).then(data => {
|
||||||
return unlink(file, err => {
|
expect(data).toStrictEqual(file)
|
||||||
if (err) throw err
|
return unlink(file, err => {
|
||||||
done()
|
if (err) throw err
|
||||||
|
done()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue