From 8848e171fa9d0e039fd2f0d04e3c802e7a4277f1 Mon Sep 17 00:00:00 2001 From: Matt Crowder Date: Sun, 10 Jun 2018 18:31:00 -0400 Subject: [PATCH 1/2] more coverage --- build-index.js | 1 + index.js | 1 + package.json | 5 +++-- test/client/reducers/index.spec.jsx | 28 ++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 test/client/reducers/index.spec.jsx diff --git a/build-index.js b/build-index.js index a911851..7f7636a 100755 --- a/build-index.js +++ b/build-index.js @@ -110,6 +110,7 @@ program.arguments("").option("-y, --yarn", "Use yarn").option("-f, --for "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/file-mock.js", "\\.(css|scss|less)$": "identity-obj-proxy" }, + modulePaths: ["src/client/"], coverageReporters: ["html"] }) diff --git a/index.js b/index.js index 37fc061..3f42f78 100644 --- a/index.js +++ b/index.js @@ -141,6 +141,7 @@ program "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/file-mock.js", "\\.(css|scss|less)$": "identity-obj-proxy" }, + modulePaths: ["src/client/"], coverageReporters: ["html"] } diff --git a/package.json b/package.json index 8959679..0ad1a62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-react-matt", - "version": "0.0.66", + "version": "0.0.67", "description": "React, Redux, Webpack, Babel, Jest, and code coverage all provided for you", "main": "build-index.js", "repository": { @@ -49,7 +49,7 @@ ], "jest": { "collectCoverageFrom": [ - "src/**/*.{js*}", + "src/client/**/*.{js*}", "!src/client/app.jsx", "!src/client/router.jsx", "!src/client/actions/sagas/config.jsx", @@ -64,6 +64,7 @@ "html", "lcov" ], + "modulePaths": ["src/client/"], "globals": { "localStorage": {} } diff --git a/test/client/reducers/index.spec.jsx b/test/client/reducers/index.spec.jsx new file mode 100644 index 0000000..119a7b6 --- /dev/null +++ b/test/client/reducers/index.spec.jsx @@ -0,0 +1,28 @@ +import rootReducer from "reducers/index"; +import initialState from "reducers/initial-state"; +import { setInput, setPing } from "actions"; + +describe("input", () => { + test("When not passing in a state, it should default to initialState.input", () => { + const result = rootReducer(undefined, {}); + expect(result.input).toEqual(initialState.input); + }); + test(`When passing in a new input, and action type of SET_INPUT, + it should give you a brand new input`, () => { + const input = "hello world!!"; + const result = rootReducer(initialState, setInput(input)); + expect(result.input).toEqual(input); + }); +}); + +describe("ping", () => { + test("When no state is passed in, initial state should be returned", () => { + const result = rootReducer(undefined, {}); + expect(result.ping).toEqual(initialState.ping); + }); + test("When you pass in a new ping through an action, it should set the ping", () => { + const ping = "hello"; + const result = rootReducer(initialState, setPing(ping)); + expect(result.ping).toEqual(ping); + }); +}); \ No newline at end of file From e27de10a83f229c11fa6a9ebbea0b2e679bda741 Mon Sep 17 00:00:00 2001 From: Matt Crowder Date: Sun, 10 Jun 2018 18:33:45 -0400 Subject: [PATCH 2/2] no browser history! --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 0ad1a62..986001f 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "jest": { "collectCoverageFrom": [ "src/client/**/*.{js*}", + "!src/client/browser-history.jsx", "!src/client/app.jsx", "!src/client/router.jsx", "!src/client/actions/sagas/config.jsx",