Repository: GermaVinsmoke/bmi-calculator
Branch: master
Commit: 7e4714d6542f
Files: 28
Total size: 20.8 KB
Directory structure:
gitextract_7xlaooi8/
├── .gitignore
├── .prettierrc.js
├── .travis.yml
├── LICENSE
├── README.md
├── cypress/
│ ├── .eslintrc.json
│ ├── integration/
│ │ └── BmiForm.spec.js
│ ├── plugins/
│ │ └── index.js
│ └── support/
│ ├── commands.js
│ └── index.js
├── cypress.json
├── jsconfig.json
├── package.json
├── public/
│ ├── index.html
│ └── robots.txt
└── src/
├── components/
│ ├── App/
│ │ ├── App.css
│ │ ├── App.jsx
│ │ └── App.test.js
│ ├── Bar/
│ │ ├── Bar.jsx
│ │ └── Bar.test.js
│ ├── BmiForm/
│ │ ├── BmiForm.jsx
│ │ └── BmiForm.test.js
│ └── Info/
│ ├── Info.jsx
│ └── Info.test.js
├── helpers/
│ └── localStorage.js
├── index.css
├── index.js
└── setupTests.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
./node_modules/
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
node_modules
================================================
FILE: .prettierrc.js
================================================
// prettier.config.js or .prettierrc.js
module.exports = {
trailingComma: 'es5',
tabWidth: 4,
useTabs: true,
semi: true,
singleQuote: true,
'editor.formatOnSave': true,
// printWidth: 80,
proseWrap: 'always',
};
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- 10.15.3
cache: npm
install:
- npm install
script:
- npm run test -- --coverage
- npm run build
after_success:
- CODECOV_TOKEN=$codecov_token npm run report-coverage
after_script:
- COVERALLS_REPO_TOKEN=$coveralls_repo_token npm run coveralls
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
local_dir: build
on:
branch: master
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2019 GermaVinsmoke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
## BMI Calculator
[](https://travis-ci.com/GermaVinsmoke/bmi-calculator)
[](https://coveralls.io/github/GermaVinsmoke/bmi-calculator?branch=master)
[](https://codecov.io/gh/GermaVinsmoke/bmi-calculator)
React Hooks app to calculate the BMI of a person. It can store the data for 7 days with the help of LocalStorage.

Created with _create-react-app_. See the [full create-react-app guide](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md).
## Install
`npm install`
## Usage
`npm start`
## Enhancement
1. Removing the dependency of Materialize-CSS module
~~2. Chart going crazy on hovering over the old points~~
================================================
FILE: cypress/.eslintrc.json
================================================
{
"plugins": ["cypress"],
"env": {
"cypress/globals": true
}
}
================================================
FILE: cypress/integration/BmiForm.spec.js
================================================
describe('BmiForm Component', () => {
beforeEach(() => {
cy.visit('/');
});
it('accepts input', () => {
const weight = '50';
const height = '176';
cy.get('#weight')
.type(weight)
.should('have.value', weight);
cy.get('#height')
.type(height)
.should('have.value', height);
});
context('Form submission', () => {
it('Adds a new bmi card data', () => {
let weight = '50';
const height = '176';
let today = new Date().toLocaleString().split(',')[0];
cy.get('#weight')
.type(weight)
.should('have.value', weight);
cy.get('#height')
.type(height)
.should('have.value', height);
cy.get('#bmi-btn').click();
cy.get('#weight').should('have.value', '');
cy.get('#height').should('have.value', '');
cy.get("[data-test='weight']").should('contain', weight);
cy.get("[data-test='height']").should('contain', height);
cy.get("[data-test='bmi']").should('contain', '16.14');
cy.get("[data-test='date']").should('contain', today);
});
});
});
================================================
FILE: cypress/plugins/index.js
================================================
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
================================================
FILE: cypress/support/commands.js
================================================
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
================================================
FILE: cypress/support/index.js
================================================
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
// Alternatively you can use CommonJS syntax:
// require('./commands')
================================================
FILE: cypress.json
================================================
{
"baseUrl": "http://localhost:3000/"
}
================================================
FILE: jsconfig.json
================================================
{
"typeAcquisition": {
"include": ["jest"]
}
}
================================================
FILE: package.json
================================================
{
"name": "bmical",
"version": "0.1.0",
"private": true,
"homepage": "http://GermaVinsmoke.github.io/bmi-calculator",
"dependencies": {
"@types/jest": "24.0.20",
"chart.js": "2.9.1",
"materialize-css": "1.0.0",
"prop-types": "15.7.2",
"react": "16.11.0",
"react-chartjs-2": "2.8.0",
"react-dom": "16.11.0",
"react-scripts": "3.1.1",
"uuid": "3.3.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
"report-coverage": "cat ./coverage/lcov.info | codecov",
"cypress": "cypress open"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}",
"!src/index.js"
]
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"codecov.io": "^0.1.6",
"coveralls": "^3.0.11",
"cypress": "^3.8.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint-plugin-cypress": "^2.10.3",
"gh-pages": "^2.2.0",
"jest-enzyme": "^7.1.2"
}
}
================================================
FILE: public/index.html
================================================