synyx / jest-canvas-snapshot-serializer

Jest snapshot serializer to generate comparable canvas snapshots
Apache License 2.0
9 stars 3 forks source link

Hashing doesn't work #3

Closed yeou closed 3 years ago

yeou commented 3 years ago

According to the documentation the snapshot should contain a hash, but when I try the example this is my result:

<canvas
  data-snapshot-image="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAA6e...[FULL_BASE_64]"
  height="200"
  width="200"
/>

My test code:

import canvasSerializer from 'jest-canvas-snapshot-serializer';
expect.addSnapshotSerializer(canvasSerializer);

it('works with canvas', () => {
    const canvas = createCanvas('#000', '#F00'); // function from your example.
    expect(canvas).toMatchSnapshot();
  });

Am I missing something?