Last active
August 4, 2021 06:42
-
-
Save YonatanKra/b037c8504f2db6443ce2ea252e916894 to your computer and use it in GitHub Desktop.
This file contains 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
(function mockDOMMatrix() { | |
class DOMMatrixMock extends DOMMatrix { | |
scale = jest.fn().mockImplementation((scaleX, scaleY) => this.setScale(scaleX, scaleY)); | |
translate = jest.fn().mockImplementation((x, y) => this.setTranslate(x,y)); | |
setScale(scaleX, scaleY) { | |
this.f = scaleY; | |
this.e = scaleX; | |
return this; | |
} | |
setTranslate(x,y){ | |
this.b = x; | |
this.c = y; | |
return this; | |
} | |
} | |
global.DOMMatrix = DOMMatrixMock; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment