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 8a8db9b8b9..3c3e6556c9 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 @@ -8,6 +8,11 @@ import './css/style.css' /* eslint-disable-next-line */ export interface SolidityUnitTestingProps {} +interface TestObject { + fileName: string + checked: boolean +} + export const SolidityUnitTesting = (props: any) => { const {helper, testTab} = props @@ -28,7 +33,7 @@ export const SolidityUnitTesting = (props: any) => { const [testsExecutionStoppedErrorHidden, setTestsExecutionStoppedErrorHidden] = useState(true) // const [testsMessage, setTestsMessage] = useState('No test file available') - var [testFiles, setTestFiles] = useState([{}]) + var [testFiles, setTestFiles] = useState([]) const [pathOptions, setPathOptions] = useState(['']) let [allTests, setAllTests] = useState([]) let [selectedTests, setSelectedTests] = useState([]) @@ -91,6 +96,7 @@ export const SolidityUnitTesting = (props: any) => { useEffect(() => { updateDirList('/') + updateForNewCurrent() }, []) const updateDirList = (path: string) => { @@ -194,7 +200,7 @@ export const SolidityUnitTesting = (props: any) => { const updateRunAction = (currentFile : any = null) => { console.log('updateRunAction --currentFile-->', currentFile) const isSolidityActive = testTab.appManager.isActive('solidity') - if (!isSolidityActive || !testFiles.length) { + if (!isSolidityActive || !testFiles?.length) { setDisableRunButton(true) if (!currentFile || (currentFile && currentFile.split('.').pop().toLowerCase() !== 'sol')) { setRunButtonTitle('No solidity file selected') @@ -344,7 +350,7 @@ export const SolidityUnitTesting = (props: any) => { /> -
{testFiles.length ? testFiles.map((testFileObj: any) => { +
{testFiles?.length ? testFiles.map((testFileObj: any) => { console.log('testFileObj----->', testFileObj) const elemId = `singleTest${testFileObj.fileName}` return (