Skip to content

Commit

Permalink
Improve consistency of canvas usage
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecRust committed Oct 31, 2023
1 parent ef129f5 commit 09fb38f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/addHeadingToImage.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const addHeadingToImage = require('./addHeadingToImage')
const canvas = require('canvas')
const { loadImage } = require('canvas')
const { calculateAvgColor } = require('./utils')

jest.mock('canvas', () => ({
Expand Down Expand Up @@ -38,7 +38,7 @@ describe('addHeadingToImage', () => {
await addHeadingToImage(imageBuffer, text, targetWidth, targetHeight)

// Verify that the loadImage function was called with the correct buffer
expect(canvas.loadImage).toHaveBeenCalledWith(imageBuffer)
expect(loadImage).toHaveBeenCalledWith(imageBuffer)

// Additional checks could be performed on the canvas context methods
// like drawImage, fillText, etc., to verify the correct behavior.
Expand Down

0 comments on commit 09fb38f

Please sign in to comment.