di-wings
Version:
Aviary Tech's common library for decentralized identity
26 lines • 809 B
TypeScript
/**
* Due to an issue with Bun (https://github.com/oven-sh/bun/issues/7823), we need to manually restore mocked modules
* after we're done. We do this by setting the mocked value to the original module.
*
* When setting up a test that will mock a module, the block should add this:
* const moduleMocker = new ModuleMocker()
*
* afterEach(() => {
* moduleMocker.clear()
* })
*
* When a test mocks a module, it should do it this way:
*
* await moduleMocker.mock('@/services/token.ts', () => ({
* getBucketToken: mock(() => {
* throw new Error('Unexpected error')
* })
* }))
*
*/
export declare class ModuleMocker {
private mocks;
mock(modulePath: string, renderMocks: () => Record<string, any>): Promise<void>;
clear(): void;
}
//# sourceMappingURL=ModuleMocker.d.ts.map