From 4f50e56e0043080d819d6a9b852b5a064c30a900 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Tue, 20 Dec 2016 11:29:54 +0000 Subject: [PATCH] add example tests for each type --- frontend/Makefile | 4 +- frontend/package.json | 4 + frontend/src/components/projects/index.js | 4 +- frontend/src/containers/org/projects.js | 12 +- frontend/src/state/selectors.js | 9 +- frontend/src/state/thunks/app.js | 5 +- frontend/test/_hook.js | 9 ++ frontend/test/actions/index.js | 25 ++++ frontend/test/{ => components}/index.js | 6 +- frontend/test/components/projects.js | 61 ++++++++ frontend/test/helpers/create.js | 61 ++++++++ frontend/test/reducers/app.js | 21 +++ frontend/test/selectors/index.js | 105 ++++++++++++++ frontend/test/thunks/app.js | 35 +++++ frontend/yarn.lock | 162 +++++++++++++++++++++- 15 files changed, 503 insertions(+), 20 deletions(-) create mode 100644 frontend/test/actions/index.js rename frontend/test/{ => components}/index.js (74%) create mode 100644 frontend/test/components/projects.js create mode 100644 frontend/test/helpers/create.js create mode 100644 frontend/test/reducers/app.js create mode 100644 frontend/test/selectors/index.js create mode 100644 frontend/test/thunks/app.js diff --git a/frontend/Makefile b/frontend/Makefile index b1a4b9a8..5649f17e 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -22,7 +22,7 @@ ui: .PHONY: test test: ui - NODE_ENV=test BABEL_DISABLE_CACHE=1 CONFIG=$(shell pwd)/webpack/index.js $(NYC) $(AVA) test/*.js $(TEST_ARGS) + NODE_ENV=test BABEL_DISABLE_CACHE=1 CONFIG=$(shell pwd)/webpack/index.js $(NYC) $(AVA) test/**/*.js $(TEST_ARGS) XUNIT_DIR := ${CIRCLE_TEST_REPORTS}/tap-xunit XUNIT := $(bindir)/tap-xunit @@ -30,7 +30,7 @@ XUNIT_OUTPUT := >> ${CIRCLE_TEST_REPORTS}/tap-xunit/xunit-$(NAME) .PHONY: test-ci test-ci: ui mkdir -p $(XUNIT_DIR) - BABEL_DISABLE_CACHE=1 NODE_ENV=test CONFIG=$(shell pwd)/webpack/index.js $(NYC) $(AVA) test/*.js -t | $(XUNIT) $(XUNIT_OUTPUT).xml + BABEL_DISABLE_CACHE=1 NODE_ENV=test CONFIG=$(shell pwd)/webpack/index.js $(NYC) $(AVA) test/**/*.js -t | $(XUNIT) $(XUNIT_OUTPUT).xml .PHONY: compile compile: ui install diff --git a/frontend/package.json b/frontend/package.json index 0ac86b1a..e5cf6078 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -25,6 +25,7 @@ "inherits": "^2.0.3", "locale": "^0.1.0", "lodash.find": "^4.6.0", + "lodash.get": "^4.4.2", "lodash.isempty": "^4.4.0", "lodash.template": "^4.4.0", "lodash.uniq": "^4.5.0", @@ -76,12 +77,15 @@ "eslint-plugin-react": "^6.8.0", "eslint-plugin-standard": "^2.0.1", "fast-async": "^6.1.2", + "jsdom": "^9.9.1", "json-loader": "^0.5.4", "ncp": "^2.0.0", "node-hook": "^0.4.0", "nyc": "^10.0.0", "pre-commit": "^1.2.2", "react-addons-test-utils": "^15.4.1", + "redux-ava": "^2.2.0", + "simple-mock": "^0.7.3", "tap-xunit": "^1.5.0", "thenify": "^3.2.1", "webpack": "^2.1.0-beta.25", diff --git a/frontend/src/components/projects/index.js b/frontend/src/components/projects/index.js index 7ad91328..a8fb3e91 100644 --- a/frontend/src/components/projects/index.js +++ b/frontend/src/components/projects/index.js @@ -23,7 +23,7 @@ const Projects = ({ const empty = projects.length ? null : ( -

+

@@ -48,7 +48,7 @@ const Projects = ({
-