-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add component test for build options
- Loading branch information
1 parent
201313d
commit e1c08e7
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import BuildOptions from "../components/BuildOptions/BuildOptions" | ||
import * as React from 'react' | ||
import flowsheetData from './data/BuildOptionsData.json' | ||
|
||
//mock props | ||
const setFlowsheetData = () => { | ||
console.log('set flowsheet data') | ||
} | ||
const setShowBuildOptions = () => { | ||
console.log('set build options') | ||
} | ||
const runBuildFlowsheet = () => { | ||
console.log('run build flowsheet') | ||
} | ||
|
||
test('test build options', () => { | ||
|
||
render( | ||
<BuildOptions | ||
flowsheetData={flowsheetData} | ||
tabValue={0} | ||
isBuilt={true} | ||
showBuildOptions={true} | ||
setShowBuildOptions={setShowBuildOptions} | ||
runBuildFlowsheet={runBuildFlowsheet} | ||
setFlowsheetData={setFlowsheetData} | ||
/> | ||
) | ||
|
||
//test for component elements | ||
screen.getByRole('textbox', { name: /String Option/i}); | ||
screen.getByRole('textbox', { name: /Int Option/i}); | ||
screen.getByRole('textbox', { name: /Float Option/i}); | ||
|
||
screen.getByRole('button', { name: /Re-build Flowsheet/i}); | ||
screen.getByRole('button', { name: /List Option valid option a/i}); | ||
screen.getByRole('heading', { name: /Model Options/i}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"inputData": { | ||
"name": "Magprex", | ||
"description": "Magprex flowsheet", | ||
"model_objects": {}, | ||
"version": 2, | ||
"requires_idaes_solver": false, | ||
"dof": 0, | ||
"sweep_results": {}, | ||
"build_options": { | ||
"TestStrOptionValid": { | ||
"name": "TestStrOptionValid", | ||
"category": "String Options", | ||
"display_name": "String Option", | ||
"description": "String Option", | ||
"display_values": [], | ||
"values_allowed": "string", | ||
"min_val": null, | ||
"max_val": null, | ||
"value": "test option" | ||
}, | ||
"TestIntOptionValid": { | ||
"name": "TestIntOptionValid", | ||
"category": "Int Options", | ||
"display_name": "Int Option", | ||
"description": "Int Option", | ||
"display_values": [], | ||
"values_allowed": "int", | ||
"min_val": 0, | ||
"max_val": 16, | ||
"value": 10 | ||
}, | ||
"TestFloatOptionValid": { | ||
"name": "TestFloatOptionValid", | ||
"category": "Float Options", | ||
"display_name": "Float Option", | ||
"description": "Float Option", | ||
"display_values": [], | ||
"values_allowed": "float", | ||
"min_val": 0, | ||
"max_val": 16, | ||
"value": 10.1 | ||
}, | ||
"TestListOptionValid": { | ||
"name": "TestListOptionValid", | ||
"category": "List Options", | ||
"display_name": "List Option", | ||
"description": "List Option", | ||
"display_values": [], | ||
"values_allowed": [ | ||
"valid option a", | ||
"valid option b" | ||
], | ||
"min_val": null, | ||
"max_val": null, | ||
"value": "valid option a" | ||
} | ||
} | ||
} | ||
} |