Created
August 4, 2021 05:09
-
-
Save YonatanKra/ddbc226add002c424eae7f8700093f53 to your computer and use it in GitHub Desktop.
Testing our drawing code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { draw } = require('./index'); | |
describe('draw', () => { | |
let canvas, ctx; | |
beforeEach(function() { | |
canvas = document.createElement('canvas'); | |
ctx = canvas.getContext('2d'); | |
}); | |
it(`should return the shape's path`, function() { | |
const shapePath = draw(ctx); | |
expect(shapePath instanceof Path2D).toBeTruthy(); | |
}); | |
it(`should draw a house on the canvas using the main ctx`, function() { | |
draw(ctx); | |
const events = ctx.__getEvents(); | |
expect(events).toMatchSnapshot(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment