forked from open-source-labs/SeeQR
-
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.
Merge pull request open-source-labs#6 from oslabs-beta/staging
Frontend testing and live sass compiler bug fix
- Loading branch information
Showing
10 changed files
with
169 additions
and
50 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,5 +1,4 @@ | ||
/node_modules | ||
/.vscode | ||
/dist | ||
/tsCompiled | ||
*/.DS_Store | ||
|
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,10 @@ | ||
{ | ||
"liveSassCompile.settings.formats": [ | ||
{ | ||
"format": "expanded", | ||
"savePath": "/frontend/assets/stylesheets/css", | ||
"extensionName": ".css" | ||
} | ||
], | ||
"liveSassCompile.settings.generateMap": false | ||
} |
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
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,33 @@ | ||
import * as React from "react"; | ||
import { History } from "../../frontend/components/leftPanel/History"; | ||
import { shallow } from "enzyme"; | ||
|
||
describe ("History feature tests", () => { | ||
// wrapper will be assigned the evaluation of the shallow render | ||
let wrapper; | ||
|
||
const props = { | ||
queries: [], | ||
currentSchema: '', | ||
|
||
} | ||
// shallow render the component before running tests | ||
beforeAll(() => { | ||
wrapper = shallow(<History {...props}/>) | ||
}) | ||
|
||
it('Should render a div', () => { | ||
expect(wrapper.type()).toEqual('div'); | ||
}) | ||
|
||
it('Should render correct h3 element', () => { | ||
expect(wrapper.containsMatchingElement( | ||
<h3>History</h3>)).toBeTruthy(); | ||
}) | ||
|
||
it('Should render query label', () => { | ||
expect(wrapper.containsMatchingElement( | ||
<td>{'Query Label'}</td>)).toBeTruthy(); | ||
}) | ||
|
||
}) |
33 changes: 33 additions & 0 deletions
33
__tests__/rightPanelTests/schemaChildrenTests/dataChildrenTests/dataTableTest.jsx
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,33 @@ | ||
import * as React from 'react'; | ||
import { mount, shallow } from 'enzyme'; | ||
import { Table } from '../../../../frontend/components/rightPanel/schemaChildren/dataChildren/DataTable'; | ||
|
||
const dummyRowData = [{"header0":"input0", "header1":1}] | ||
|
||
const dummyTableProps = { | ||
queries: [{ | ||
queryString: "string", | ||
queryData: dummyRowData, | ||
queryStatistics: 7, | ||
querySchema: "string", | ||
queryLabel: "string" | ||
}] | ||
}; | ||
|
||
describe('Testing the data table', () => { | ||
let wrapper; | ||
beforeAll(() => { | ||
wrapper = mount(<Table { ...dummyTableProps }/>); | ||
}) | ||
|
||
it('should render Table headers', () => { | ||
expect(wrapper.find('#dataTableHead').type()).toBe('thead'); | ||
expect(wrapper.find('#dataTableHead').childAt(0).childAt(0).text()).toBe('HEADER0'); | ||
expect(wrapper.find('#dataTableHead').childAt(0).childAt(1).text()).toBe('HEADER1'); | ||
}) | ||
|
||
it('should render data Table body element', () => { | ||
expect(wrapper.find('#dataTableBody').type()).toBe('tbody'); | ||
}) | ||
}) | ||
|
37 changes: 37 additions & 0 deletions
37
__tests__/rightPanelTests/schemaChildrenTests/dataTest.jsx
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,37 @@ | ||
import * as React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { Data } from '../../../frontend/components/rightPanel/schemaChildren/Data'; | ||
|
||
|
||
const dummyTableProps = { | ||
queries: [{ | ||
queryString: "string", | ||
queryData: [{}], | ||
queryStatistics: 7, | ||
querySchema: "string", | ||
queryLabel: "string" | ||
}] | ||
}; | ||
|
||
describe ("Data tests", () => { | ||
const { queries } = dummyTableProps; | ||
|
||
// shallow render the component before running tests | ||
let wrapper; | ||
beforeAll(() => { | ||
wrapper = shallow(<Data { ...dummyTableProps } />) | ||
}) | ||
|
||
it('Should render a div', () => { | ||
expect(wrapper.type()).toEqual('div'); | ||
}) | ||
|
||
it('Should render h3 tag', () => { | ||
expect(wrapper.containsMatchingElement( | ||
<h3 id="results-title">Data Table</h3>)).toBeTruthy(); | ||
}) | ||
|
||
it('Should render div to contain the data table', () => { | ||
expect(wrapper.find('#data-table').type()).toBe('div'); | ||
}) | ||
}) |
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,21 @@ | ||
import * as React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { Tab } from '../../../frontend/components/rightPanel/tabsChildren/Tab'; | ||
|
||
const dummyTabProps = { | ||
onClickTabItem: 'string', | ||
currentSchema: "string", | ||
label: "string", | ||
}; | ||
|
||
describe ("Tab tests", () => { | ||
// shallow render the component before running tests | ||
let wrapper; | ||
beforeAll(() => { | ||
wrapper = shallow(<Tab { ...dummyTabProps } />) | ||
}) | ||
|
||
it('Should render a list item', () => { | ||
expect(wrapper.type()).toEqual('li'); | ||
}) | ||
}) |
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,39 +1,35 @@ | ||
import * as React from "react"; | ||
import * as renderer from "react-test-renderer"; | ||
import { Splash } from "../frontend/components/Splash"; | ||
import { shallow } from "enzyme"; | ||
|
||
describe ("Splash page tests", () => { | ||
// wrapper will be assigned the evaluation of the shallow render | ||
let wrapper; | ||
let shallowRender; | ||
// mock functions to pass to handlers | ||
const mockFileClick = jest.fn(() => { | ||
return; | ||
}) | ||
const mockSkipClick = jest.fn(() => { | ||
return; | ||
}) | ||
const mockFileClick = jest.fn(() => console.log("click")); | ||
const mockSkipClick = jest.fn(() => console.log("skipClick")); | ||
// props to be passed to the shallow render of the component | ||
const props = { | ||
openSplash: true, | ||
handleFileClick: mockFileClick, | ||
handleSkipClick: mockSkipClick | ||
} | ||
handleSkipClick: mockSkipClick, | ||
handleFileClick: mockFileClick | ||
}; | ||
|
||
let wrapper; | ||
// shallow render the component before running tests | ||
beforeAll(() => { | ||
// wrapper = new Splash(props); | ||
// shallowRender = shallow<Splash>(wrapper); | ||
wrapper = shallow(<Splash {...props}/>) | ||
}) | ||
}); | ||
|
||
// it('should work', () => { | ||
// expect(wrapper).toBeInstanceOf(Splash); | ||
// }) | ||
it('should find the correct elements by id', () => { | ||
expect(wrapper.find('#skip_button').type()).toBe('button'); | ||
expect(wrapper.find('#yes_button').type()).toBe('button'); | ||
}); | ||
|
||
it('The functions passed down should be invoked on click', () => { | ||
// wrapper.find({ id: 'skip_button'}).simulate('click'); | ||
// expect(mockFileClick).toHaveBeenCalled(); | ||
expect(wrapper.type()).toEqual('div'); | ||
}) | ||
}) | ||
// testing the skip button | ||
wrapper.find('#skip_button').simulate('click'); | ||
expect(mockSkipClick).toHaveBeenCalled(); | ||
// testing the import button | ||
wrapper.find('#yes_button').simulate('click'); | ||
expect(mockFileClick).toHaveBeenCalled(); | ||
}); | ||
}); |
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
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