From 7dc5657f39f59f61a78b468a99129d3736b5aeaa Mon Sep 17 00:00:00 2001 From: Alessandro Gorla Date: Tue, 1 Sep 2026 16:55:48 +0200 Subject: [PATCH] test: sync sn-plugin-lib jest mock with actual usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found while auditing the codebase for other 0.1.65-related breakage: PluginCommAPI.getPageDisplaySize (added in the previous fix) had no mock entry — any future test importing App.tsx/sdk.ts would throw "getPageDisplaySize is not a function" instead of exercising the code. No current test does, so this was latent, not an active failure. Also drop the PluginFileAPI and PointUtils mock blocks: neither module is imported anywhere in src/, App.tsx, or index.js anymore (PluginFileAPI. getPageSize was the API replaced by getPageDisplaySize; PointUtils was never used by this plugin). Keeping unused mock surface around just invites it to silently drift from reality again. Co-Authored-By: Claude Sonnet 5 --- __mocks__/sn-plugin-lib.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/__mocks__/sn-plugin-lib.js b/__mocks__/sn-plugin-lib.js index a2e56e6..3ad9835 100644 --- a/__mocks__/sn-plugin-lib.js +++ b/__mocks__/sn-plugin-lib.js @@ -23,25 +23,14 @@ const PluginManager = { const PluginCommAPI = { getCurrentFilePath: jest.fn(() => ok('/storage/emulated/0/Note/demo.note')), getCurrentPageNum: jest.fn(() => ok(0)), + getPageDisplaySize: jest.fn(() => ok({width: 1404, height: 1872})), lassoElements: jest.fn(() => ok(true)), setLassoBoxState: jest.fn(() => ok(true)), getLassoElements: jest.fn(() => ok([])), reloadFile: jest.fn(() => ok(true)), }; -const PluginFileAPI = { - getPageSize: jest.fn(() => ok({width: 1404, height: 1872})), - generateNotePng: jest.fn(() => ok(true)), -}; - -const PointUtils = { - androidPoint2Emr: jest.fn(p => p), - emrPoint2Android: jest.fn(p => p), -}; - module.exports = { PluginManager, PluginCommAPI, - PluginFileAPI, - PointUtils, };