From 8027a3036cd0cef553098cf511d99012aa3750f8 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 12 Sep 2022 15:24:49 +0200 Subject: [PATCH] test(crypto-js): Remove dependency to `canvas`. --- bindings/matrix-sdk-crypto-js/package.json | 1 - bindings/matrix-sdk-crypto-js/tests/device.test.js | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bindings/matrix-sdk-crypto-js/package.json b/bindings/matrix-sdk-crypto-js/package.json index 02f1108c7..726466786 100644 --- a/bindings/matrix-sdk-crypto-js/package.json +++ b/bindings/matrix-sdk-crypto-js/package.json @@ -26,7 +26,6 @@ "pkg/matrix_sdk_crypto.d.ts" ], "devDependencies": { - "canvas": "^2.10.1", "cross-env": "^7.0.3", "fake-indexeddb": "^4.0", "jest": "^28.1.0", diff --git a/bindings/matrix-sdk-crypto-js/tests/device.test.js b/bindings/matrix-sdk-crypto-js/tests/device.test.js index 9a60f1497..d9d4fd609 100644 --- a/bindings/matrix-sdk-crypto-js/tests/device.test.js +++ b/bindings/matrix-sdk-crypto-js/tests/device.test.js @@ -749,7 +749,9 @@ describe('Key Verification', () => { expect(qrCode).toBeInstanceOf(QrCode); - let canvasBuffer; + // Want to get `canvasBuffer` to render the QR code? Install `npm install canvas` and uncomment the following blocks. + + //let canvasBuffer; { const buffer = qrCode.renderIntoBuffer(); @@ -760,6 +762,7 @@ describe('Key Verification', () => { // 0 for a white pixel, 1 for a black pixel. expect(buffer.every(p => p == 0 || p == 1)).toStrictEqual(true); + /* const { Canvas } = require('canvas'); const canvas = new Canvas(55, 55); @@ -792,6 +795,7 @@ describe('Key Verification', () => { context.putImageData(imageData, 5, 5); canvasBuffer = canvas.toBuffer('image/png'); + */ } // Want to see the QR code? Uncomment the following block.