Implement comprehensive UI test suite with meaningful assertions and best practices (#921)

This commit is contained in:
Copilot
2025-12-20 02:13:31 +01:00
committed by GitHub
parent 55f8b7d2b7
commit 8285627c5f
16 changed files with 1150 additions and 279 deletions

View File

@@ -14,26 +14,27 @@ export const setTopic = (topic?: string): Action => {
}
}
export const openFile = (encoding: 'utf8' = 'utf8') => async (dispatch: Dispatch<any>, getState: () => AppState) => {
try {
const file = await getFileContent(encoding)
if (file) {
dispatch(
setPayload(file.data))
export const openFile =
(encoding: 'utf8' = 'utf8') =>
async (dispatch: Dispatch<any>, getState: () => AppState) => {
try {
const file = await getFileContent(encoding)
if (file) {
dispatch(setPayload(file.data))
}
} catch (error) {
dispatch(showError(error))
}
} catch (error) {
dispatch(showError(error))
}
}
type FileParameters = {
name: string,
name: string
data: string
}
async function getFileContent(encoding: string): Promise<FileParameters | undefined> {
const rejectReasons = {
noFileSelected: 'No file selected',
errorReadingFile: 'Error reading file'
errorReadingFile: 'Error reading file',
}
const { canceled, filePaths } = await rendererRpc.call(makeOpenDialogRpc(), {