code improvement

pull/5370/head
aniket-engg 3 years ago committed by Aniket
parent 2477a508b9
commit 0084d41563
  1. 8
      libs/remix-ui/solidity-unit-testing/src/lib/solidity-unit-testing.tsx

@ -116,12 +116,10 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
useEffect(() => { useEffect(() => {
testTab.on('filePanel', 'newTestFileCreated', async (file: string) => { testTab.on('filePanel', 'newTestFileCreated', async (file: string) => {
try { try {
testTabLogic.getTests((error: any, tests: any) => { const tests = await testTabLogic.getTests()
if (error) return setToasterMsg(error)
allTests.current = tests allTests.current = tests
selectedTests.current = [...allTests.current] selectedTests.current = [...allTests.current]
updateTestFileList() updateTestFileList()
})
} catch (e) { } catch (e) {
console.log(e) console.log(e)
allTests.current.push(file) allTests.current.push(file)
@ -169,14 +167,14 @@ export const SolidityUnitTesting = (props: Record<string, any>) => {
if (await testTabLogic.pathExists(testDirInput)) { if (await testTabLogic.pathExists(testDirInput)) {
setDisableCreateButton(true) setDisableCreateButton(true)
setDisableGenerateButton(false) setDisableGenerateButton(false)
await setCurrentPath(testDirInput)
} else { } else {
// Enable Create button // Enable Create button
setDisableCreateButton(false) setDisableCreateButton(false)
// Disable Generate button because dir does not exist // Disable Generate button because dir does not exist
setDisableGenerateButton(true) setDisableGenerateButton(true)
await setCurrentPath(testDirInput)
} }
await setCurrentPath(testDirInput)
} }
} else { } else {
await setCurrentPath('/') await setCurrentPath('/')

Loading…
Cancel
Save