Fixed tests with mocks

This commit is contained in:
Zemledelec 2025-04-12 23:07:20 +04:00
parent e3c4ef6a7f
commit 65cab5d5c5
3 changed files with 16 additions and 1 deletions

View File

@ -11,5 +11,9 @@ module.exports = {
testRegex: [
"\\.test\\.js$",
"\\.test\\.ts$",
]
],
moduleNameMapper: {
'\\.worker\\.js\\?worker&inline$': '<rootDir>/tests/__mocks__/workerMock.js',
'\\.glsl$': '<rootDir>/tests/__mocks__/glslMock.js'
}
};

View File

@ -0,0 +1 @@
export default 'void main() {}';

View File

@ -0,0 +1,10 @@
export default class MockWorker {
constructor() {
this.postMessage = jest.fn();
this.terminate = jest.fn();
this.addEventListener = jest.fn();
this.removeEventListener = jest.fn();
this.onmessage = null;
this.onerror = null;
}
}