Skip to content

Commit

Permalink
response to comments
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Santos <nick.santos@docker.com>
  • Loading branch information
nicks committed Oct 21, 2022
1 parent 61431d0 commit d9b95c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions __tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* test canvas
*/

import { ver, setupCanvasMock } from '../src';
import { ver, setJestCanvasMock } from '../src';
import pkg from '../package.json';

let canvas;
Expand All @@ -21,7 +21,7 @@ describe('setupCanvasMock', () => {
it('should setup after resetAllMocks', () => {
jest.resetAllMocks();
expect(document.createElement('canvas').getContext('2d')).toBe(undefined);
setupCanvasMock();
setJestCanvasMock();
expect(document.createElement('canvas').getContext('2d')).toHaveProperty(
'createImageData'
);
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if (typeof window !== 'undefined') {
}

export const ver = '__VERSION__';
export function setupCanvasMock(window) {

export function setJestCanvasMock(window) {
mockWindow(window || global.window);
}
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function setupCanvasMock(window?: Window) {}
export function setJestCanvasMock(window?: Window) {}

export interface CanvasRenderingContext2DEvent {
/**
Expand Down

0 comments on commit d9b95c7

Please sign in to comment.