import { mockData } from './mockData' ; export class ContextMock implements Partial < CanvasRenderingContext2D > { private _imageData : ImageData = { data : new Uint8ClampedArray ( mockData ) , width : this . canvas . width , height : this . canvas . height } ; get canvas ( ) : HTMLCanvasElement { return this . _canvas ; } constructor ( private _canvas ) { } getImageData ( _sx , _sy , _sw , _sh ) { return { ... this . _imageData , data : new Uint8ClampedArray ( Array . from ( this . _imageData . data ) ) } ; } putImageData ( imagedata , dx , dy ) ; putImageData ( imagedata , dx , dy , dirtyX , dirtyY , dirtyWidth , dirtyHeight ) ; putImageData ( imagedata , _dx , _dy , _dirtyX ? , _dirtyY ? , _dirtyWidth ? , _dirtyHeight ? ) { this . _imageData = imagedata ; } }