forked from watertap-org/watertap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9defaf9
commit 56e9cef
Showing
8 changed files
with
732 additions
and
3 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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import App from './App'; | ||
import { BrowserRouter } from "react-router-dom"; | ||
|
||
test('renders learn react link', () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
render(<BrowserRouter> <App /> </BrowserRouter>); | ||
}); |
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,12 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import Graph from "Components/Graph/Graph" | ||
|
||
//mock props | ||
|
||
test('test input accordion', () => { | ||
|
||
render( <Graph></Graph> ) | ||
|
||
//test for component elements | ||
screen.getByRole('img', { name: /flowsheet/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,13 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import Header from "Components/Boilerplate/Header/Header" | ||
|
||
//mock props | ||
|
||
test('test input accordion', () => { | ||
|
||
render( <Header></Header> ) | ||
|
||
//test for component elements | ||
screen.getByRole('link', { name: /NAWI logo/i}); | ||
screen.getByRole('img', { name: /NAWI logo/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,50 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import InputAccordion from "Components/InputAccordion/InputAccordion" | ||
|
||
//mock props | ||
const key = "" | ||
|
||
const mockSections = { | ||
"": { | ||
"display_name": "", | ||
"variables": { | ||
"flow_vol": { | ||
"value": { | ||
"index": [ | ||
[ | ||
0 | ||
] | ||
], | ||
"value": [ | ||
0.0003286 | ||
], | ||
"bounds": [ | ||
[ | ||
null, | ||
null | ||
] | ||
] | ||
}, | ||
"display_name": "flow_vol", | ||
"description": "Volumetric flowrate in feed", | ||
"display_units": "m<sup>3</sup>/s", | ||
"indices": [], | ||
"scale_factor": 0, | ||
"to_units": "", | ||
"readonly": false, | ||
"category": "" | ||
}, | ||
} | ||
} | ||
} | ||
|
||
test('test input accordion', () => { | ||
|
||
render( <InputAccordion dataKey={key} data={mockSections[key]}></InputAccordion> ) | ||
|
||
//test for component elements | ||
screen.getByRole('button', { name: ""}); | ||
screen.getByRole('region', { name: ""}); | ||
screen.getByRole('textbox', { name: /flow_vol/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,41 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import InputWrapper from "Components/InputWrapper/InputWrapper" | ||
|
||
//mock props | ||
const key = "flow_vol" | ||
const fieldData = { | ||
"value": { | ||
"index": [ | ||
[ | ||
0 | ||
] | ||
], | ||
"value": [ | ||
0.0003286 | ||
], | ||
"bounds": [ | ||
[ | ||
null, | ||
null | ||
] | ||
] | ||
}, | ||
"display_name": "flow_vol", | ||
"description": "Volumetric flowrate in feed", | ||
"display_units": "m<sup>3</sup>/s", | ||
"indices": [], | ||
"scale_factor": 0, | ||
"to_units": "", | ||
"readonly": false, | ||
"category": "" | ||
} | ||
|
||
test('test input wrapper', () => { | ||
|
||
render( <InputWrapper key={key} fieldData={fieldData}></InputWrapper> ) | ||
|
||
//test for component elements | ||
screen.getByRole('textbox', { name: /flow_vol/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,31 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import NewFlowsheetDialog from "Components/NewFlowsheetDialog/NewFlowsheetDialog" | ||
|
||
|
||
//mock props | ||
const open = true | ||
const mockClose = () => { | ||
console.log("close"); | ||
}; | ||
|
||
test('test new flowsheet dialog', () => { | ||
render( <NewFlowsheetDialog open={open} onClose={mockClose}></NewFlowsheetDialog> ) | ||
|
||
//test that all textboxes are present | ||
screen.getByRole('textbox', { name: /flowsheet name/i}); | ||
screen.getByRole('textbox', { name: /has bypass/i}); | ||
screen.getByRole('textbox', { name: /has desal feed/i}); | ||
screen.getByRole('textbox', { name: /is twostage/i}); | ||
screen.getByRole('textbox', { name: /has erd/i}); | ||
screen.getByRole('textbox', { name: /nf type/i}); | ||
screen.getByRole('textbox', { name: /nf base/i}); | ||
screen.getByRole('textbox', { name: /ro type/i}); | ||
screen.getByRole('textbox', { name: /ro base/i}); | ||
screen.getByRole('textbox', { name: /ro level/i}); | ||
|
||
//test that cancel and create buttons are present | ||
screen.getByRole('button', { name: /cancel/i}) | ||
screen.getByRole('button', { name: /create/i}) | ||
|
||
//screen.debug(); | ||
}) |
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,12 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import Page from "Components/Page/Page" | ||
|
||
//mock props | ||
|
||
test('test input accordion', () => { | ||
|
||
render( <Page></Page> ) | ||
|
||
//test for component elements | ||
screen.getByRole('img', { name: /flowsheet/i}); | ||
}) |
Oops, something went wrong.