Apply suggestions from code review

This commit is contained in:
Michael Li 2025-01-12 13:55:24 -05:00 committed by Sirz Benjie
parent 031ea40fa8
commit 610b82c4c0
No known key found for this signature in database
GPG Key ID: 4A524B4D196C759E
2 changed files with 8 additions and 4 deletions

View File

@ -9,13 +9,13 @@ let firstTime = true;
* The list of listeners that were present during the first time this manager is run. * The list of listeners that were present during the first time this manager is run.
* These initial listeners are needed throughout the entire test suite, so we never remove them. * These initial listeners are needed throughout the entire test suite, so we never remove them.
*/ */
const initialListeners: unknown[] = []; const initialListeners: NodeJS.MessageListener[] = [];
/** /**
* The current listener that is only needed for the current test file. * The current listener that is only needed for the current test file.
* We plan to delete it during the next test file, when it is no longer needed. * We plan to delete it during the next test file, when it is no longer needed.
*/ */
let currentListener; let currentListener: NodeJS.MessageListener | null;
export function manageListeners() { export function manageListeners() {
if (firstTime) { if (firstTime) {

View File

@ -5,11 +5,15 @@ import { mockCanvas } from "#test/utils/mocks/mockCanvas";
*/ */
export const mockContext: any = { export const mockContext: any = {
font: "", font: "",
//@ts-ignore measureText: () => {
measureText: () => new TextMetrics(""), return {};
},
save: () => {}, save: () => {},
scale: () => {}, scale: () => {},
clearRect: () => {}, clearRect: () => {},
fillRect: () => {},
fillText: () => {},
getImageData: () => {},
canvas: mockCanvas, canvas: mockCanvas,
restore: () => {}, restore: () => {},
}; };