canvasimo icon indicating copy to clipboard operation
canvasimo copied to clipboard

Create custom snapshot renderer

Open JakeSidSmith opened this issue 7 years ago • 0 comments

This should stub the CanvasRenderingContext2D and create an ascii representation that is written to a file to check for changes later.

expect(context).toMatchCanvasSnapshot();
expect.extend({
  toMatchCanvasSnapshot(received, argument) {
    const pass = //;

    if (pass) {
      return {
        message: () => `expected ${received} not to match snapshot ${snapshot}`,
        pass: true,
      };
    } else {
      return {
        message: () => `expected ${received} to match snapshot ${snapshot}`,
        pass: false,
      };
    }
  }
});

JakeSidSmith avatar Jan 31 '18 21:01 JakeSidSmith