Skip to content

Instantly share code, notes, and snippets.

@sam-artuso

sam-artuso/test.js

Created Feb 14, 2017
Embed
What would you like to do?
How to unit test a promise deliberately designed to side-effect?
// demo.js
function f() {
return Promise.resolve(true)
}
function g() {
Promise.resolve(true)
}
module.exports = { f, g }
// demo.test.js
const demo = require('./demo')
describe('f()', () => {
it('should resolve to true', () => {
return demo.f().then(result => {
expect(result).toBe(true)
})
})
})
describe('g()', () => {
it.skip('should resolve to true', () => {
// ???
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment