diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts b/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts index 6e955c1074..80a65d5f8f 100644 --- a/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts +++ b/libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts @@ -35,8 +35,7 @@ export class TestTabLogic { return res } - generateTestFile () { - console.log('Inside generateTestFile-1SUT-currentFile-', this.fileManager.currentFile(), this.currentPath) + generateTestFile (errorCb: any) { let fileName = this.fileManager.currentFile() const hasCurrent = !!fileName && this.fileManager.currentFile().split('.').pop().toLowerCase() === 'sol' if (!hasCurrent) fileName = this.currentPath + '/newFile.sol' @@ -45,10 +44,9 @@ export class TestTabLogic { const splittedFileName = fileName.split('/') const fileNameToImport = (!hasCurrent) ? fileName : this.currentPath + '/' + splittedFileName[splittedFileName.length - 1] this.helper.createNonClashingNameWithPrefix(fileNameToImport, fileProvider, '_test', (error: any, newFile: any) => { - // if (error) return modalDialogCustom.alert('Failed to create file. ' + newFile + ' ' + error) + if (error) return errorCb('Failed to create file. ' + newFile + ' ' + error) const isFileCreated = fileProvider.set(newFile, this.generateTestContractSample(hasCurrent, fileName)) - console.log('isFileCreated--->', isFileCreated) - // if (!isFileCreated) return modalDialogCustom.alert('Failed to create test file ' + newFile) + if (!isFileCreated) return errorCb('Failed to create test file ' + newFile) this.fileManager.open(newFile) this.fileManager.syncEditor(newFile) }) diff --git a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx index 63de9bfb57..01627196e1 100644 --- a/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx +++ b/libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx @@ -676,7 +676,7 @@ export const SolidityUnitTesting = (props: Record) => { title="Generate sample test file." disabled={disableGenerateButton} onClick={() => { - testTabLogic.generateTestFile() + testTabLogic.generateTestFile((err:any) => { if (err) setToasterMsg(err)}) updateForNewCurrent() }} >