update test files on generate file

pull/5370/head
Aniket-Engg 3 years ago committed by Aniket
parent 3c19efa05f
commit ad92922725
  1. 12
      libs/remix-ui/solidity-unit-testing/src/lib/logic/testTabLogic.ts
  2. 5
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx

@ -47,12 +47,12 @@ 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)
const isFileCreated = fileProvider.set(newFile, this.generateTestContractSample(hasCurrent, fileName))
console.log('isFileCreated---->', isFileCreated)
// if (!isFileCreated) return modalDialogCustom.alert('Failed to create test file ' + newFile)
this.fileManager.open(newFile)
this.fileManager.syncEditor(newFile)
// if (error) return modalDialogCustom.alert('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)
this.fileManager.open(newFile)
this.fileManager.syncEditor(newFile)
})
}

@ -324,7 +324,10 @@ export const SolidityUnitTesting = (props: any) => {
data-id="testTabGenerateTestFile"
title="Generate sample test file."
disabled={disableGenerateButton}
onClick={testTabLogic.generateTestFile.bind(testTabLogic)}
onClick={() => {
testTabLogic.generateTestFile()
updateForNewCurrent()
}}
>
Generate
</button>

Loading…
Cancel
Save