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

Move unit tests to src #84

Closed
Closed
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
1 change: 1 addition & 0 deletions minimal_redux_poc/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
config/
coverage/
2 changes: 1 addition & 1 deletion minimal_redux_poc/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dist/
coverage/

.idea
15 changes: 15 additions & 0 deletions minimal_redux_poc/jest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["html"],
"setupFiles": [
"<rootDir>/setupJest.js"
],
"testMatch": [
"<rootDir>/**/__tests__/**/*.{js,jsx}",
"<rootDir>/src/**/?(*.)(spec|test|unit).{js,jsx}"
],
"preset": "jest-puppeteer"
}
49 changes: 37 additions & 12 deletions minimal_redux_poc/package-lock.json

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

14 changes: 3 additions & 11 deletions minimal_redux_poc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
"scripts": {
"lint": "node_modules/.bin/eslint ./",
"server": "node_modules/.bin/http-server",
"test": "npm run build && npm run lint && node_modules/.bin/jest",
"test:watch": "npm test -- --watch",
"test": "npm run build && npm run lint && jest -c jest.json",
"test:coverage": "jest -c jest.json --coverage",
"test:watch": "jest -c jest.json --watch",
"build": "webpack --mode=production",
"build:dev": "webpack --mode=development",
"build:watch": "webpack --watch --mode=development",
Expand Down Expand Up @@ -67,14 +68,5 @@
"style-loader": "^0.22.1",
"webpack": "^4.27.1",
"webpack-cli": "^3.1.2"
},
"jest": {
"preset": "jest-puppeteer",
"setupFiles": [
"./setupJest.js"
],
"testPathIgnorePatterns": [
"__tests__/integration/react-example/.*jsx?"
]
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';

import * as actions from '../../../src/actions/index';
import ActionTypes from '../../../src/action-types';
import * as actions from '../../actions/index';
import ActionTypes from '../../action-types';

const middlewares = [thunk];
const mockStore = configureMockStore(middlewares);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import Display from '../../../src/components/Display';
import ManifestMetadata from '../../../src/components/ManifestMetadata';
import fixture from '../../fixtures/2.json';
import Display from '../../components/Display';
import ManifestMetadata from '../../components/ManifestMetadata';
import fixture from '../fixtures/2.json';

describe('Display', () => {
it('renders without an error', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { shallow } from 'enzyme';
import { store } from '../../../src/store';
import ManifestListItem from '../../../src/components/ManifestListItem';
import { store } from '../../store';
import ManifestListItem from '../../components/ManifestListItem';

describe('ManifestListItem', () => {
it('renders without an error', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import { actions, store } from '../../../src/store';
import ManifestMetadata from '../../../src/components/ManifestMetadata';
import fixture from '../../fixtures/2.json';
import { actions, store } from '../../store';
import ManifestMetadata from '../../components/ManifestMetadata';
import fixture from '../fixtures/2.json';

describe('ManifestMetadata', () => {
let wrapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
import { actions, store } from '../../../src/store';
import Window from '../../../src/components/Window';
import fixture from '../../fixtures/24.json';
import { actions, store } from '../../store';
import Window from '../../components/Window';
import fixture from '../fixtures/24.json';

describe('Window', () => {
let wrapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import { actions, store } from '../../../src/store';
import WindowTopBar from '../../../src/components/WindowTopBar';
import fixture from '../../fixtures/24.json';
import { actions, store } from '../../store';
import WindowTopBar from '../../components/WindowTopBar';
import fixture from '../fixtures/24.json';

describe('Window', () => {
let wrapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { shallow } from 'enzyme';
import { actions, store } from '../../../src/store';
import Workspace from '../../../src/components/Workspace';
import fixture from '../../fixtures/2.json';
import { actions, store } from '../../store';
import Workspace from '../../components/Workspace';
import fixture from '../fixtures/2.json';

describe('Workspace', () => {
let wrapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import reducer from '../../../src/reducers/config';
import ActionTypes from '../../../src/action-types';
import reducer from '../../reducers/config';
import ActionTypes from '../../action-types';

describe('config reducer', () => {
describe('SET_CONFIG', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import reducer from '../../../src/reducers/manifests';
import ActionTypes from '../../../src/action-types';
import reducer from '../../reducers/manifests';
import ActionTypes from '../../action-types';

describe('manifests reducer', () => {
it('should handle REQUEST_MANIFEST', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import reducer from '../../../src/reducers/windows';
import ActionTypes from '../../../src/action-types';
import reducer from '../../reducers/windows';
import ActionTypes from '../../action-types';

describe('windows reducer', () => {
it('should handle ADD_WINDOW', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import reducer from '../../../src/reducers/workspace';
import ActionTypes from '../../../src/action-types';
import reducer from '../../reducers/workspace';
import ActionTypes from '../../action-types';

describe('workspace reducer', () => {
it('should handle FOCUS_WINDOW', () => {
Expand Down