refactor: return a Promise instead of relying on callback parameter (#289)

This commit is contained in:
Darek Kay 2020-10-04 22:11:18 +02:00 committed by GitHub
parent f1d576fda7
commit d44b70a1f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,14 +30,17 @@ test('create contributors section if content is empty', () => {
expect(result).toMatchSnapshot() expect(result).toMatchSnapshot()
}) })
test('README exists', done => { test('README exists', () => {
return new Promise(done => {
const file = 'README.md' const file = 'README.md'
ensureFileExists(file) ensureFileExists(file)
.then(data => expect(data).toStrictEqual(file)) .then(data => expect(data).toStrictEqual(file))
.then(_ => done()) .then(_ => done())
})
}) })
test("LOREM doesn't exists", done => { test("LOREM doesn't exists", () => {
return new Promise(done => {
const file = 'LOREM.md' const file = 'LOREM.md'
ensureFileExists(file).then(data => { ensureFileExists(file).then(data => {
expect(data).toStrictEqual(file) expect(data).toStrictEqual(file)
@ -46,4 +49,5 @@ test("LOREM doesn't exists", done => {
done() done()
}) })
}) })
})
}) })