add more mocking

This commit is contained in:
Jordan
2025-03-04 07:20:00 -08:00
parent 61e54ded3c
commit 5352ae8eb1
3 changed files with 41 additions and 23 deletions

View File

@ -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(),
})),
};
});