diff --git a/reconcile-js/__mocks__/wasm.js b/reconcile-js/__mocks__/wasm.js new file mode 100644 index 0000000..e67f920 --- /dev/null +++ b/reconcile-js/__mocks__/wasm.js @@ -0,0 +1,9 @@ +const fs = require('fs'); +const path = require('path'); + +// Read the actual WASM file and convert to base64 for testing +const wasmPath = path.join(__dirname, '../../pkg/reconcile_bg.wasm'); +const wasmBuffer = fs.readFileSync(wasmPath); +const wasmBase64 = wasmBuffer.toString('base64'); + +module.exports = wasmBase64; diff --git a/reconcile-js/jest.config.js b/reconcile-js/jest.config.js index 8c1027e..d8542ff 100644 --- a/reconcile-js/jest.config.js +++ b/reconcile-js/jest.config.js @@ -1,3 +1,6 @@ module.exports = { - preset: "ts-jest/presets/js-with-babel-esm" + preset: 'ts-jest/presets/js-with-babel-esm', + moduleNameMapper: { + '^reconcile/reconcile_bg\\.wasm$': `/__mocks__/wasm.js`, + }, };