Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
bd14f69f
Commit
bd14f69f
authored
Apr 17, 2020
by
aniket-engg
Committed by
Aniket
Apr 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
file is imported and test file contract is testSuite
parent
dfb7866e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
testTab.js
src/app/tabs/testTab/testTab.js
+12
-5
No files found.
src/app/tabs/testTab/testTab.js
View file @
bd14f69f
...
...
@@ -14,7 +14,11 @@ class TestTabLogic {
if
(
!
fileProvider
)
return
helper
.
createNonClashingNameWithPrefix
(
fileName
,
fileProvider
,
'_test'
,
(
error
,
newFile
)
=>
{
if
(
error
)
return
modalDialogCustom
.
alert
(
'Failed to create file. '
+
newFile
+
' '
+
error
)
if
(
!
fileProvider
.
set
(
newFile
,
this
.
generateTestContractSample
()))
return
modalDialogCustom
.
alert
(
'Failed to create test file '
+
newFile
)
const
splittedFileName
=
fileName
.
split
(
'/'
)
// This is fine for now because test file is created on same path where file to be tested is.
// This should be updated to pass complete path, if test file comes from different directory/path
const
fileNameToImport
=
splittedFileName
[
splittedFileName
.
length
-
1
]
if
(
!
fileProvider
.
set
(
newFile
,
this
.
generateTestContractSample
(
fileNameToImport
)))
return
modalDialogCustom
.
alert
(
'Failed to create test file '
+
newFile
)
this
.
fileManager
.
switchFile
(
newFile
)
})
}
...
...
@@ -37,12 +41,15 @@ class TestTabLogic {
cb
(
null
,
tests
,
path
)
}
generateTestContractSample
()
{
return
`pragma solidity >=0.4.0 <0.7.0;
// TODO: If currently selected file is compiled and compilation result is available,
// 'contractName' should be <compiledContractName> + '_testSuite'
generateTestContractSample
(
fileToImport
,
contractName
=
'testSuite'
)
{
return
`pragma solidity >=0.4.22 <0.7.0;
import "remix_tests.sol"; // this import is automatically injected by Remix.
import "./
${
fileToImport
}
";
//
file name has to end with '_test.sol'
contract
test_1
{
//
File name has to end with '_test.sol', this file can contain more than one testSuite contracts
contract
${
contractName
}
{
/// 'beforeAll' runs before all other tests
/// More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment