Skip to content

Commit

Permalink
(testing) front end testing suite
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinD-A committed Oct 1, 2020
2 parents 33e319c + bf63e48 commit 4feec3d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as React from "react";
import * as renderer from "react-test-renderer";
import { Compare } from "../frontend/components/leftPanel/Compare";
import { Compare } from "../../frontend/components/leftPanel/Compare";
import { shallow } from "enzyme";
import { stringify } from "querystring";

describe ("Comparison feature tests", () => {
// wrapper will be assigned the evaluation of the shallow render
Expand All @@ -11,18 +9,17 @@ describe ("Comparison feature tests", () => {
const props = {
queries: [],
currentSchema: '',

}
// shallow render the component before running tests
beforeAll(() => {
wrapper = shallow(<Compare {...props}/>)
})

it('Should render a div', () => {
expect(wrapper.type()).toEqual('div');
})

it('Should render h3 tag', () => {
it('Should render correct h3 element', () => {
expect(wrapper.containsMatchingElement(
<h3>Comparisons</h3>)).toBeTruthy();
})
Expand Down
33 changes: 33 additions & 0 deletions __tests__/leftPanelTests/historyTest.jsx
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();
})

})
30 changes: 0 additions & 30 deletions __tests__/mainPanelTest.jsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
// mock getKeys
// mock getHeader
// mock getRowsData
import * as React from 'react';
import { mount, shallow } from 'enzyme';
import { Table } from '../../../../frontend/components/rightPanel/schemaChildren/dataChildren/DataTable';

// test that the table gets populated
// the headers get written
// need keys to
// the rows populate

const dummyRowData = [{"header0":"header0", "header1":"header1"}, {"header0":"input0", "header1":1}]

// still don't understand the structure of the data that's coming in
const dummyRowData = [{"header0":"input0", "header1":1}]

const dummyTableProps = {
queries: [{
Expand All @@ -36,10 +26,8 @@ describe('Testing the data table', () => {
expect(wrapper.find('#dataTableHead').childAt(0).childAt(1).text()).toBe('HEADER1');
})

it('should render Table data', () => {
it('should render data Table body element', () => {
expect(wrapper.find('#dataTableBody').type()).toBe('tbody');
expect(wrapper.find('#dataTableBody').childAt(0).childAt(0).text()).toBe('input0');
expect(wrapper.find('#dataTableBody').childAt(0).childAt(1).text()).toBe('1');
})
})

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"codemirror": "^5.57.0",
"concurrently": "^5.3.0",
"cross-env": "^7.0.2",
"electron": "^9.0.0",
"electron-store": "^6.0.0",
"faker": "^5.1.0",
"fix-path": "^3.0.0",
Expand Down Expand Up @@ -61,7 +60,7 @@
"babel-minify-webpack-plugin": "^0.3.1",
"csp-html-webpack-plugin": "^4.0.0",
"css-loader": "^3.5.3",
"electron": "^9.0.0",
"electron": "^9.3.1",
"electron-devtools-installer": "^3.0.0",
"electron-packager": "^14.2.1",
"enzyme": "^3.11.0",
Expand All @@ -81,7 +80,7 @@
"ts-loader": "^8.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.7",
"webpack": "^4.43.0",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
},
Expand Down

0 comments on commit 4feec3d

Please sign in to comment.