Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #20

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,8 @@ venv

# Build folder
build

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
16 changes: 16 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -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)
9 changes: 4 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -23,11 +24,11 @@
"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",
"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",
Expand Down Expand Up @@ -68,6 +69,7 @@
},
"proxy": "http://localhost:5000",
"devDependencies": {
"@types/jest": "^26.0.0",
"env-cmd": "^10.1.0"
}
}
20 changes: 20 additions & 0 deletions src/__tests__/Button.test.js
Original file line number Diff line number Diff line change
@@ -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(
<Button
color = "white"
children = "click me"
round = {true}
fullWidth = {false}
disabled = {false}
/>,div)
})
});
41 changes: 41 additions & 0 deletions src/__tests__/ChartCard.test.js
Original file line number Diff line number Diff line change
@@ -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)
})
26 changes: 26 additions & 0 deletions src/__tests__/CustomInput.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import ReactDom from 'react-dom';
import { Grid } from "material-ui";
import {ContentCopy, LocalOffer} from "material-ui-icons";

import { CustomInput } from "components";

describe("CustomInput component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<CustomInput
labelText = "label Text"
id = "customInput"
inputProps={{
placeholder: "Search",
inputProps: {"aria-label": "Search"}
}}
formControlProps={{
className: "class name"
}}
error = {false}
success = {true}
/>,div)
})
});
11 changes: 11 additions & 0 deletions src/__tests__/DoughnutChart.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from "react";
import ReactDom from 'react-dom';

import DoughnutChart from "../components/Charts/Doughnut";

describe("DoughnutChart component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(<DoughnutChart />,div)
})
});
42 changes: 42 additions & 0 deletions src/__tests__/DoughnutChart2.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from "react";
import ReactDom from 'react-dom';

import {Doughnut, Chart} from 'react-chartjs-2';

describe("DoughnutChart component", () => {
const div = document.createElement('div');
const Data = {
labels: ['LTCH', 'ETH', 'BTC'],
datasets: [
{
label: 'Portfolio',
data: [66000, 145000, 845000],
backgroundColor: ['#1b9868', '#ffd700', '#ec6d10']
}
]
};

const comp = ReactDom.render(
<Doughnut
data={Data} width={400} height={400}
options={{
responsive: true,
maintainAspectRatio: true }}
onElementsClick={elems => {
try {
console.log(elems[0]._index);
} catch (error) {
console.log(error)
}
}}
/>,div);
test('Crypto currencies shown in DoughnutChart matches with actual Crypto currencies of User',()=>{
expect(comp.props.data.labels).toEqual(Data.labels)
})
test('Amount of Investment shown in DoughnutChart matches with actual Investment of User',()=>{
expect(comp.props.data.datasets[0].data).toEqual(Data.datasets[0].data)
})
test('Colour assigned to each crypto currency is same as passed through props',()=>{
expect(comp.props.data.datasets[0].backgroundColor).toEqual(Data.datasets[0].backgroundColor)
})
});
15 changes: 15 additions & 0 deletions src/__tests__/HearderLink.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";
import ReactDom from 'react-dom';
import {Hidden} from "material-ui";

import { HeaderLinks } from "components";

describe("HeaderLink component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<Hidden smDown implementation="css">
<HeaderLinks />
</Hidden>,div)
})
});
16 changes: 16 additions & 0 deletions src/__tests__/ItemGrid.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import ReactDom from 'react-dom';

import { ItemGrid } from "components";

describe("ItemGrid component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<ItemGrid xs={12} sm={6}>
<div className="test class">
<h4>testing ItemGrid</h4>
</div>
</ItemGrid>,div)
})
});
17 changes: 17 additions & 0 deletions src/__tests__/OrderPopup.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from "react";
import ReactDom from 'react-dom';

import OrderPopup from "../components/Popup/OrderPopup"

describe("OrderPopup component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<OrderPopup
type="sell"
tick="LTC"
name="Litecoin"
percentChange="3"
/>,div)
})
});
34 changes: 34 additions & 0 deletions src/__tests__/RegularCard.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";
import ReactDom from 'react-dom';
import { Grid } from "material-ui";

import { RegularCard,Small,ItemGrid } from "components";

describe("RegularCard component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<RegularCard
headerColor= "purple"
cardTitle = "testing card title"
cardSubtitle = "testing card subtitle"
content = {
<div>
<Grid container justify="center">
<ItemGrid xs={12} sm={12} md={6} style={{ textAlign: "center" }}>
<h5>
Notifications Places
<Small>Click to view notifications</Small>
</h5>
</ItemGrid>
</Grid>
</div>
}
footer = {
<div>
<h4> footer of the card</h4>
</div>
}
/>,div)
})
});
22 changes: 22 additions & 0 deletions src/__tests__/Snackbar.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import ReactDom from 'react-dom';
import {LocalOffer} from "material-ui-icons";

import { Snackbar } from "components";

describe("Snackbar component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<Snackbar
message={
'Testing Snackbar'
}
color="danger"
close = {false}
icon = {LocalOffer}
place = "tl"
open = {true}
/>,div)
})
});
20 changes: 20 additions & 0 deletions src/__tests__/SnackbarContent.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import ReactDom from 'react-dom';
import {LocalOffer} from "material-ui-icons";

import { SnackbarContent } from "components";

describe("SnackbarContent component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<SnackbarContent
message={
'Testing SnackbarContent'
}
color="danger"
close = {false}
icon = {LocalOffer}
/>,div)
})
});
22 changes: 22 additions & 0 deletions src/__tests__/StatsCard.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import ReactDom from 'react-dom';
import {ContentCopy, LocalOffer} from "material-ui-icons";

import { StatsCard } from "components";

describe("StatsCard component", () => {
test('renders without crashing',()=>{
const div = document.createElement('div');
ReactDom.render(
<StatsCard
// classes: PropTypes.object.isRequired
icon = {ContentCopy}
iconColor = "red"
title = "testing title"
description = "testing description"
small = "GB"
statIcon = {LocalOffer}
statIconColor = "gray"
/>,div)
})
});
Loading