diff --git a/examples/dataset-frictionless/components/Chart.js b/examples/dataset-frictionless/components/Chart.js deleted file mode 100644 index 95904994..00000000 --- a/examples/dataset-frictionless/components/Chart.js +++ /dev/null @@ -1,31 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import createPlotlyComponent from "react-plotly.js/factory"; - -let Plot; - -const Chart = (props) => { - const [plotCreated, setPlotCreated] = useState(0) //0: false, 1: true - - useEffect(() => { - import(`plotly.js-basic-dist`).then(Plotly => { //import Plotly dist when Page has been generated - Plot = createPlotlyComponent(Plotly); - setPlotCreated(1) - }); - }, []) - - if (!plotCreated) { - return (
Loading...
) - } - - return ( -
- -
- ) -} - -export default Chart \ No newline at end of file diff --git a/examples/dataset-frictionless/components/Table.js b/examples/dataset-frictionless/components/Table.js deleted file mode 100644 index c2865a4d..00000000 --- a/examples/dataset-frictionless/components/Table.js +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable max-len */ -import React from 'react'; -import { DataGrid } from '@material-ui/data-grid'; -/* - * @param schema: Frictionless Table Schmea - * @param data: an array of data objects e.g. [ {a: 1, b: 2}, {a: 5, b: 7} ] - */ -const Table = ({ schema, data }) => { - const columns = schema.fields.map((field) => ( - { - field: field.title || field.name, - headerName: field.name, - width: 300 - } - )) - data = data.map((item, index)=>{ - item.id = index //Datagrid requires every row to have an ID - return item - }) - - return ( -
- -
- ); -} - -export default Table diff --git a/examples/dataset-frictionless/tests/components/Chart.test.js b/examples/dataset-frictionless/tests/components/Chart.test.js deleted file mode 100644 index 3f17ea34..00000000 --- a/examples/dataset-frictionless/tests/components/Chart.test.js +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react' -import {render } from '@testing-library/react'; -import path from 'path' -import Chart from '../../components/Chart'; -import { getDataset } from "../../lib/dataset" -import { addView } from '../../lib/utils' - - -let dataset -let datasetWithView - -beforeAll(async () => { - const datasetsDirectory = path.join(process.cwd(), 'fixtures', 'datasetsPlotlyView') - dataset = await getDataset(datasetsDirectory) - datasetWithView = addView(dataset) -}); - - -/** @test {Chart Component} */ -describe('Chart Component', () => { - it('should render without crashing', async () => { - const spec = JSON.parse(datasetWithView.props.specs)[0] - const { findByTestId } = render() - expect(await findByTestId("plotlyChart")) - }); -}); \ No newline at end of file diff --git a/examples/dataset-frictionless/tests/components/Table.test.js b/examples/dataset-frictionless/tests/components/Table.test.js deleted file mode 100644 index f2670d66..00000000 --- a/examples/dataset-frictionless/tests/components/Table.test.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import { render } from '@testing-library/react'; -import path from 'path' -import Table from '../../components/Table'; -import { getDataset } from "../../lib/dataset" - - -let dataset - -beforeAll(async () => { - const datasetsDirectory = path.join(process.cwd(), 'fixtures', 'datasetsPlotlyView') - dataset = await getDataset(datasetsDirectory) -}); - - -/** @test {Table Component} */ -describe('Table Component', () => { - it('should render without crashing', async () => { - const resource = dataset.resources[0] - render() - }); - it('tableGrid div is found', async () => { - const resource = dataset.resources[0] - const { findByTestId } = render(
) - expect(await findByTestId('tableGrid')) - }); -}); \ No newline at end of file diff --git a/examples/dataset-frictionless/tests/pages/index.test.js b/examples/dataset-frictionless/tests/pages/index.test.js deleted file mode 100644 index 894ec611..00000000 --- a/examples/dataset-frictionless/tests/pages/index.test.js +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react' -import { render } from '@testing-library/react'; -import path from 'path' -import Home from '../../pages/index'; -import { getDataset } from "../../lib/dataset" -import { addView } from '../../lib/utils' - - -let plotlyDatasetWithView - -beforeAll(async () => { - const plotlyDatasetsDirectory = path.join(process.cwd(), 'fixtures', 'datasetsPlotlyView') - - const plotlyDataset = await getDataset(plotlyDatasetsDirectory) - plotlyDatasetWithView = addView(plotlyDataset) -}); - - -/** @test {Home Component} */ -describe('Home Component', () => { - it('should render without crashing', async () => { - const dataset = plotlyDatasetWithView.props.dataset - const specs = plotlyDatasetWithView.props.specs - const { findAllByText } = render() - expect(await findAllByText('README')) - - }); - it('Sections are found in home page', async () => { - const dataset = plotlyDatasetWithView.props.dataset - const specs = plotlyDatasetWithView.props.specs - const { findByTestId, findAllByText } = render() - expect(await findAllByText('Key info')) - expect(await findAllByText('Data Files')) - expect(await findAllByText('Graph')) - expect(await findAllByText('Data Preview')) - expect(await findByTestId('datasetTitle')) - - }); -}); \ No newline at end of file