Files
privacy.sexy/tests/unit/infrastructure/Dialog/Electron/ElectronFileDialogOperationsStub.ts
undergroundwires a721e82a4f Bump TypeScript to 5.3 with verbatimModuleSyntax
This commit upgrades TypeScript to the latest version 5.3 and introduces
`verbatimModuleSyntax` in line with the official Vue guide
recommendatinos (vuejs/docs#2592).

By enforcing `import type` for type-only imports, this commit improves
code clarity and supports tooling optimization, ensuring imports are
only bundled when necessary for runtime.

Changes:

- Bump TypeScript to 5.3.3 across the project.
- Adjust import statements to utilize `import type` where applicable,
  promoting cleaner and more efficient code.
2024-02-27 04:20:22 +01:00

46 lines
1.5 KiB
TypeScript

import type { ElectronFileDialogOperations } from '@/infrastructure/Dialog/Electron/NodeElectronSaveFileDialog';
import { StubWithObservableMethodCalls } from '@tests/unit/shared/Stubs/StubWithObservableMethodCalls';
export class ElectronFileDialogOperationsStub
extends StubWithObservableMethodCalls<ElectronFileDialogOperations>
implements ElectronFileDialogOperations {
private mimicUserCancel = false;
private userDownloadsPath = `[${ElectronFileDialogOperationsStub.name}] downloads path`;
private userSelectedFilePath = `${ElectronFileDialogOperationsStub.name} user selected file path`;
public withMimicUserCancel(isCancelled: boolean): this {
this.mimicUserCancel = isCancelled;
return this;
}
public withUserDownloadsPath(userDownloadsPath: string): this {
this.userDownloadsPath = userDownloadsPath;
return this;
}
public withUserSelectedFilePath(userSelectedFilePath: string): this {
this.userSelectedFilePath = userSelectedFilePath;
return this;
}
public getUserDownloadsPath(): string {
return this.userDownloadsPath;
}
public showSaveDialog(
options: Electron.SaveDialogOptions,
): Promise<Electron.SaveDialogReturnValue> {
this.registerMethodCall({
methodName: 'showSaveDialog',
args: [options],
});
const returnValue: Electron.SaveDialogReturnValue = {
canceled: this.mimicUserCancel,
filePath: this.userSelectedFilePath,
};
return Promise.resolve(returnValue);
}
}