Fix crypto mock in Cache.test.ts to preserve full module
The jest.mock('crypto') was replacing the entire module, causing
@smithy/uuid to fail with "Cannot read properties of undefined
(reading 'bind')" when @backstage/backend-test-utils was imported.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Fredrik Adelöw <freben@spotify.com>
This commit is contained in:
@@ -24,11 +24,13 @@ import { readFile } from 'node:fs/promises';
|
||||
import { join as joinPath } from 'node:path';
|
||||
|
||||
jest.mock('crypto', () => {
|
||||
const actual = jest.requireActual('crypto');
|
||||
const hash = {
|
||||
update: jest.fn(),
|
||||
digest: jest.fn().mockReturnValue('test'),
|
||||
};
|
||||
return {
|
||||
...actual,
|
||||
createHash: jest.fn().mockReturnValue(hash),
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user