add more mocking
This commit is contained in:
@ -8,20 +8,33 @@ import { Knex } from "knex";
|
||||
|
||||
const RENDER_TIME = 1000;
|
||||
|
||||
jest.mock('@/app/lib/whisper', () => {
|
||||
const originalModule = jest.requireActual('@/app/lib/whisper');
|
||||
// Mock the WhisperFile class
|
||||
jest.mock("@/app/lib/whisper", () => {
|
||||
const originalModule = jest.requireActual("@/app/lib/whisper");
|
||||
|
||||
return {
|
||||
...originalModule,
|
||||
Whisper: class {
|
||||
constructor(...args) {
|
||||
originalModule.Whisper.apply(this, args);
|
||||
}
|
||||
WhisperFile: jest.fn().mockImplementation((tag, targetFileName, label, size) => ({
|
||||
tag,
|
||||
targetFileName,
|
||||
label,
|
||||
size,
|
||||
doesTargetExist: jest.fn(),
|
||||
getDownloadStatus: jest.fn(), // Mock other methods as needed
|
||||
isDownloadcomplete: () => true,
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
targetFile = {
|
||||
bytes: jest.fn().mockReturnValue(new Uint8Array([/* mock data */])),
|
||||
};
|
||||
},
|
||||
jest.mock("expo-file-system", () => {
|
||||
const originalModule = jest.requireActual("expo-file-system");
|
||||
|
||||
return {
|
||||
...originalModule,
|
||||
File: jest.fn().mockImplementation(() => ({
|
||||
bytes: jest.fn(),
|
||||
exists: jest.fn(),
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user