Skip to content

Commit

Permalink
feat(tests): restored existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte authored and Raphaël Benitte committed Dec 5, 2017
1 parent 7467315 commit e4cf806
Show file tree
Hide file tree
Showing 32 changed files with 244 additions and 29 deletions.
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ node_js:
- '8'
script:
- make init
- make packages-test
- make website-build
- make storybook-build
#- yarn run fmt:check
#- yarn run test:cover
#after_success:
# - yarn run coverage
27 changes: 21 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SOURCES = packages

.PHONY: help init packages-build packages-publish clean-all website website-build website-deploy storybook storybook-build storybook-deploy deploy-all
.PHONY: help bootstrap init packages-build packages-publish clean-all website website-build website-deploy storybook storybook-build storybook-deploy deploy-all

########################################################################################################################
#
Expand Down Expand Up @@ -35,17 +35,22 @@ help: ##prints help

.DEFAULT_GOAL := help

########################################################################################################################
#
# INIT
#
########################################################################################################################

bootstrap: ##@init lerna bootstrap
@./node_modules/.bin/lerna bootstrap

init: ##@init cleanup/install/bootstrap
@make clean-all
@yarn install
@./node_modules/.bin/lerna bootstrap
@make bootstrap
@make packages-build
@cd website && yarn install

deploy-all: ##@deploy deploy website & storybook
@make website-deploy
@make storybook-deploy

########################################################################################################################
#
# CLEANUP
Expand Down Expand Up @@ -77,6 +82,11 @@ endef
#
########################################################################################################################

packages-test: ##@packages run tests for all packages
# stream can be used for a mire verbose output
#@./node_modules/.bin/lerna run --concurrency 1 --stream test
@./node_modules/.bin/lerna run --concurrency 1 test

packages-build: ##@packages build all packages
@echo "${YELLOW}Building all packages${RESET}"
@$(foreach source, $(SOURCES), $(call clean-source-lib, $(source)))
Expand Down Expand Up @@ -124,3 +134,8 @@ storybook-deploy: ##@storybook build and deploy storybook

@echo "${YELLOW}Deploying storybook${RESET}"
@./node_modules/.bin/gh-pages -d storybook-static -r [email protected]:plouc/nivo.git -b gh-pages -e storybook


deploy-all: ##@deploy deploy website & storybook
@make website-deploy
@make storybook-deploy
11 changes: 1 addition & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,19 @@
"@nivo/babel-preset": "^0.32.0-9",
"lodash": "^4.17.4",
"prop-types": "^15.5.10",
"puppeteer": "^0.13.0",
"react-motion": "^0.5.1"
"puppeteer": "^0.13.0"
},
"devDependencies": {
"@storybook/addon-info": "^3.2.17",
"@storybook/addon-knobs": "^3.2.17",
"@storybook/react": "^3.2.17",
"clog-cli": "^1.0.0",
"cross-env": "^5.0.5",
"enzyme": "^2.9.1",
"gh-pages": "^1.0.0",
"lerna": "^2.5.1",
"lint-staged": "^4.1.0",
"nivo-generators": "0.9.3",
"prettier": "^1.6.1",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-test-renderer": "^15.6.1",
"validate-commit-msg": "^2.14.0"
},
"peerDependencies": {
Expand All @@ -48,10 +43,6 @@
"module": "es/index.js",
"jsnext:main": "es/index.js",
"scripts": {
"test": "npm run test:unit",
"test:cover": "npm run test:unit:cover",
"test:unit": "jest --verbose ./test",
"test:unit:cover": "jest --verbose --coverage ./test",
"fmt": "prettier --print-width=100 --tab-width=4 --bracket-spacing --no-semi --trailing-comma es5 --single-quote --color --write \"{src,specs,test,.storybook,stories}/**/*.js\"",
"fmt:check": "prettier --print-width=100 --tab-width=4 --bracket-spacing --no-semi --trailing-comma es5 --single-quote --list-different \"{src,specs,test,.storybook,stories}/**/*.js\"",
"disabledPrepublishOnly": "npm test && npm run build",
Expand Down
3 changes: 1 addition & 2 deletions packages/nivo-bar/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@
/storybook-static

# test
.travis.yml
/coverage
/test
/tests
5 changes: 4 additions & 1 deletion packages/nivo-bar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"cross-env": "^5.0.5",
"jest": "^21.0.1",
"react": "^15.6.1",
"react-dom": "^15.6.1"
"react-dom": "^15.6.1",
"react-test-renderer": "^15.6.1"
},
"peerDependencies": {
"prop-types": "^15.5.10",
Expand All @@ -29,6 +30,8 @@
"access": "public"
},
"scripts": {
"test": "jest --verbose ./tests",
"test:cover": "jest --verbose --coverage ./tests",
"build:commonjs": "rm -rf lib && cross-env NODE_ENV=commonjs babel src --out-dir lib",
"build:commonjs:watch": "npm run build:commonjs -- --watch",
"build:es": "rm -rf es && cross-env NODE_ENV=es babel src --out-dir es",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import renderer from 'react-test-renderer'
import Bar from '../../../../src/components/charts/bar/Bar'
import Bar from '../src/Bar'

it('should render a basic bar chart', () => {
const component = renderer.create(
Expand Down
2 changes: 1 addition & 1 deletion packages/nivo-calendar/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# test
.travis.yml
/coverage
/test
/tests
2 changes: 1 addition & 1 deletion packages/nivo-chord/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# test
.travis.yml
/coverage
/test
/tests
2 changes: 1 addition & 1 deletion packages/nivo-circle-packing/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
# test
.travis.yml
/coverage
/test
/tests
20 changes: 20 additions & 0 deletions packages/nivo-core/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
4 changes: 4 additions & 0 deletions packages/nivo-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"babel-cli": "^6.26.0",
"babel-jest": "^20.0.3",
"cross-env": "^5.0.5",
"enzyme": "^3.2.0",
"enzyme-adapter-react-16": "^1.1.0",
"jest": "^21.0.1",
"react": "^15.6.1",
"react-dom": "^15.6.1"
Expand All @@ -34,6 +36,8 @@
"access": "public"
},
"scripts": {
"test": "jest --verbose ./tests",
"test:cover": "jest --verbose --coverage ./tests",
"build:commonjs": "rm -rf lib && cross-env NODE_ENV=commonjs babel src --out-dir lib",
"build:commonjs:watch": "npm run build:commonjs -- --watch",
"build:es": "rm -rf es && cross-env NODE_ENV=es babel src --out-dir es",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
* file that was distributed with this source code.
*/
import React from 'react'
import { shallow } from 'enzyme'
import { configure, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { curveLinear, curveBasis, curveMonotoneY } from 'd3-shape'
import withCurve from '../../src/hocs/withCurve'

configure({ adapter: new Adapter() })

it('should append d3 curve interpolator', () => {
const Sample = withCurve()('div')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
* file that was distributed with this source code.
*/
import React from 'react'
import { shallow } from 'enzyme'
import { configure, shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import { defaultMargin } from '../../src/defaults'
import withDimensions from '../../src/hocs/withDimensions'

configure({ adapter: new Adapter() })

it('should add default margin', () => {
const Sample = withDimensions()('div')

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions packages/nivo-heatmap/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
20 changes: 20 additions & 0 deletions packages/nivo-line/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
20 changes: 20 additions & 0 deletions packages/nivo-pie/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
20 changes: 20 additions & 0 deletions packages/nivo-radar/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
20 changes: 20 additions & 0 deletions packages/nivo-sankey/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
20 changes: 20 additions & 0 deletions packages/nivo-stream/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
20 changes: 20 additions & 0 deletions packages/nivo-sunburst/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
20 changes: 20 additions & 0 deletions packages/nivo-treemap/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# src (will be transpiled)
/src

# logs
*.log*

# OSX
.DS_Store

# config/build
.babelrc

# storybook
/.storybook
/stories
/storybook-static

# test
/coverage
/tests
Loading

0 comments on commit e4cf806

Please sign in to comment.