Created
January 7, 2019 11:55
-
-
Save seogi1004/91ea7bbc7c65582836f65cd127e42481 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sinon from 'sinon'; | |
const createElement = global.document.createElement; | |
const FAKECanvasElement = { | |
getContext: jest.fn(() => { | |
return { | |
fillStyle: null, | |
fillRect: jest.fn(), | |
drawImage: jest.fn(), | |
getImageData: jest.fn(), | |
}; | |
}), | |
}; | |
sinon.stub(global.document, 'createElement') | |
.callsFake(createElement) | |
.withArgs('canvas') | |
.returns(FAKECanvasElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment