From 0084d4156336412dfa7063a5d175b9f4e161af73 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 31 Dec 2021 14:17:35 +0530 Subject: [PATCH] code improvement --- .../src/lib/solidity-unit-testing.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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 e51b80f73e..0e791fd0ec 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 @@ -116,12 +116,10 @@ export const SolidityUnitTesting = (props: Record) => { useEffect(() => { testTab.on('filePanel', 'newTestFileCreated', async (file: string) => { try { - testTabLogic.getTests((error: any, tests: any) => { - if (error) return setToasterMsg(error) - allTests.current = tests - selectedTests.current = [...allTests.current] - updateTestFileList() - }) + const tests = await testTabLogic.getTests() + allTests.current = tests + selectedTests.current = [...allTests.current] + updateTestFileList() } catch (e) { console.log(e) allTests.current.push(file) @@ -134,7 +132,7 @@ export const SolidityUnitTesting = (props: Record) => { }) testTab.fileManager.events.on('noFileSelected', () => { }) // eslint-disable-line - testTab.fileManager.events.on('currentFileChanged', async(file: any, provider: any) => await updateForNewCurrent(file)) + testTab.fileManager.events.on('currentFileChanged', async (file: any, provider: any) => await updateForNewCurrent(file)) }, []) // eslint-disable-line @@ -169,14 +167,14 @@ export const SolidityUnitTesting = (props: Record) => { if (await testTabLogic.pathExists(testDirInput)) { setDisableCreateButton(true) setDisableGenerateButton(false) - await setCurrentPath(testDirInput) + } else { // Enable Create button setDisableCreateButton(false) // Disable Generate button because dir does not exist setDisableGenerateButton(true) - await setCurrentPath(testDirInput) } + await setCurrentPath(testDirInput) } } else { await setCurrentPath('/')