From 49fa5f00f1012b3648c008e5bb1c4d0d1f43b44f Mon Sep 17 00:00:00 2001 From: harsh-2711 Date: Wed, 24 Jun 2020 12:04:43 +0530 Subject: [PATCH 1/3] Added Chart Card test --- .gitignore | 5 ++++ index.js | 16 +++++++++++++ package-lock.json | 9 ++++---- package.json | 4 ++-- src/__tests__/ChartCard.test.js | 41 +++++++++++++++++++++++++++++++++ 5 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 index.js create mode 100644 src/__tests__/ChartCard.test.js diff --git a/.gitignore b/.gitignore index 8cdbd98..c3a72b4 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,8 @@ venv # Build folder build + +# Elastic Beanstalk Files +.elasticbeanstalk/* +!.elasticbeanstalk/*.cfg.yml +!.elasticbeanstalk/*.global.yml diff --git a/index.js b/index.js new file mode 100644 index 0000000..261b515 --- /dev/null +++ b/index.js @@ -0,0 +1,16 @@ +// ./index.js +const express = require('express') +const path = require('path') +const port = process.env.PORT || 3000 +const app = express() + +// serve static assets normally +app.use(express.static(__dirname + '/public')) + +// Handles all routes so you do not get a not found error +app.get('*', function(request, response) { + response.sendFile(path.resolve(__dirname, 'public', 'index.html')) +}) + +app.listen(port) +console.log("server started on port " + port) \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 2322293..462a5a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14804,14 +14804,13 @@ } }, "react": { - "version": "16.3.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.3.0.tgz", - "integrity": "sha512-Qh35tNbwY8SLFELkN3PCLO16EARV+lgcmNkQnoZXfzAF1ASRpeucZYUwBlBzsRAzTb7KyfBaLQ4/K/DLC6MYeA==", + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz", + "integrity": "sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==", "requires": { - "fbjs": "^0.8.16", "loose-envify": "^1.1.0", "object-assign": "^4.1.1", - "prop-types": "^15.6.0" + "prop-types": "^15.6.2" } }, "react-app-polyfill": { diff --git a/package.json b/package.json index 36e9b11..4e8e252 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "npm-run-all": "^4.1.1", "perfect-scrollbar": "^1.3.0", "prop-types": "^15.7.2", - "react": "^16.2.0", + "react": "^16.13.1", "react-autosuggest": "^10.0.0", "react-chartist": "^0.13.1", "react-chartjs-2": "^2.9.0", @@ -69,4 +69,4 @@ "devDependencies": { "env-cmd": "^10.1.0" } -} \ No newline at end of file +} diff --git a/src/__tests__/ChartCard.test.js b/src/__tests__/ChartCard.test.js new file mode 100644 index 0000000..1a5e404 --- /dev/null +++ b/src/__tests__/ChartCard.test.js @@ -0,0 +1,41 @@ +import React from "react"; +import ReactDom from 'react-dom'; +import ChartistGraph from "react-chartist"; +import { AccessTime } from "material-ui-icons"; + +import ChartCard from '../components/Cards/ChartCard'; +import { emailsSubscriptionChart } from "../variables/charts"; + + +test('renders without crashing', () => { + const div = document.createElement('div'); + ReactDom.render( < + ChartCard classes = { + { "card": "chartCard" }, + { "cardHeader": "chart" }, + { "cardContent": "data over view" }, + { "cardTitle": "for test" }, + { "cardCategory": "primary" }, + { "cardActions": "none" }, + { "cardStats": "open" }, + { "cardStatsIcon": "none" }, + { "cardStatsLink": "url" } + } + chart = { < + ChartistGraph + className = "ct-chart" + data = { emailsSubscriptionChart.data } + type = "Bar" + options = { emailsSubscriptionChart.options } + responsiveOptions = { emailsSubscriptionChart.responsiveOptions } + listener = { emailsSubscriptionChart.animation } + /> + } + chartColor = "orange" + title = "Sentiment Analysis" + text = "Last Year Performance" + statIcon = { AccessTime } + statText = "Updated 2 minutes ago" / + > + , div) +}) \ No newline at end of file From 43201b786f554598f36359eed60851bbb363aec7 Mon Sep 17 00:00:00 2001 From: jay-mehta531 <201701446@daiict.ac.in> Date: Wed, 24 Jun 2020 13:10:29 +0530 Subject: [PATCH 2/3] Added test files and Updated package.json --- package.json | 6 +++-- src/__tests__/Button.test.js | 20 ++++++++++++++++ src/__tests__/CustomInput.test.js | 26 ++++++++++++++++++++ src/__tests__/HearderLink.test.js | 15 ++++++++++++ src/__tests__/ItemGrid.test.js | 16 +++++++++++++ src/__tests__/RegularCard.test.js | 34 +++++++++++++++++++++++++++ src/__tests__/Snackbar.test.js | 22 +++++++++++++++++ src/__tests__/SnackbarContent.test.js | 20 ++++++++++++++++ src/__tests__/StatsCard.test.js | 22 +++++++++++++++++ src/__tests__/Table.test.js | 17 ++++++++++++++ 10 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 src/__tests__/Button.test.js create mode 100644 src/__tests__/CustomInput.test.js create mode 100644 src/__tests__/HearderLink.test.js create mode 100644 src/__tests__/ItemGrid.test.js create mode 100644 src/__tests__/RegularCard.test.js create mode 100644 src/__tests__/Snackbar.test.js create mode 100644 src/__tests__/SnackbarContent.test.js create mode 100644 src/__tests__/StatsCard.test.js create mode 100644 src/__tests__/Table.test.js diff --git a/package.json b/package.json index 4e8e252..9e8323e 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "chart.js": "^2.9.3", "chartist": "^0.10.1", "classnames": "^2.2.5", + "d3": "^5.16.0", "d3-dsv": "^1.2.0", "d3-format": "^1.4.4", "d3-scale": "^3.2.1", @@ -27,7 +28,7 @@ "react-autosuggest": "^10.0.0", "react-chartist": "^0.13.1", "react-chartjs-2": "^2.9.0", - "react-dom": "^16.12.0", + "react-dom": "^16.13.1", "react-google-maps": "^9.4.5", "react-router-dom": "^4.2.2", "react-scripts": "^3.3.1", @@ -67,6 +68,7 @@ }, "proxy": "http://localhost:5000", "devDependencies": { + "@types/jest": "^26.0.0", "env-cmd": "^10.1.0" } -} +} \ No newline at end of file diff --git a/src/__tests__/Button.test.js b/src/__tests__/Button.test.js new file mode 100644 index 0000000..7e5ab5f --- /dev/null +++ b/src/__tests__/Button.test.js @@ -0,0 +1,20 @@ +import React from "react"; +import ReactDom from 'react-dom'; +import { Grid } from "material-ui"; +import {ContentCopy, LocalOffer} from "material-ui-icons"; + +import { Button } from "components"; + +describe("Button component", () => { + test('renders without crashing',()=>{ + const div = document.createElement('div'); + ReactDom.render( +