react-jester
Advanced tools
Comparing version 1.2.0 to 1.2.1-beta.0
@@ -0,0 +0,0 @@ ## [1.2.0] - 2021-01-30 |
@@ -8,5 +8,4 @@ import { ContainerTest } from '../types'; | ||
* @param {ContainerTest<TContainer, TState>[]} tests - Array of functions that return test configurations | ||
* @param {bool} [redux=false] - Whether or not the container connects to redux | ||
* @returns {void} | ||
*/ | ||
export declare const testContainer: <TContainer, TState = Record<string, unknown>>(description: string, tests: ContainerTest<TContainer, TState>[], redux?: boolean) => void; | ||
export declare const testContainer: <TContainer, TState = Record<string, unknown>>(description: string, tests: ContainerTest<TContainer, TState>[]) => void; |
@@ -5,6 +5,3 @@ "use strict"; | ||
var React = require("react"); | ||
var react_redux_1 = require("react-redux"); | ||
var react_test_renderer_1 = require("react-test-renderer"); | ||
var redux_mock_store_1 = require("redux-mock-store"); | ||
var redux_thunk_1 = require("redux-thunk"); | ||
/** | ||
@@ -16,3 +13,2 @@ * Build and run tests for your containers from an array of test config building functions | ||
* @param {ContainerTest<TContainer, TState>[]} tests - Array of functions that return test configurations | ||
* @param {bool} [redux=false] - Whether or not the container connects to redux | ||
* @returns {void} | ||
@@ -22,11 +18,3 @@ * @docgen_description_note | ||
*/ | ||
var testContainer = function (description, tests, redux) { | ||
if (redux === void 0) { redux = false; } | ||
var getReduxProvider = function (state, container) { | ||
// Arrange | ||
var middlewares = [redux_thunk_1.default]; | ||
var mockStore = redux_mock_store_1.default(middlewares); | ||
// Act | ||
return react_test_renderer_1.create(React.createElement(react_redux_1.Provider, { store: mockStore(state) }, container)); | ||
}; | ||
var testContainer = function (description, tests) { | ||
afterAll(function () { | ||
@@ -50,3 +38,3 @@ jest.clearAllMocks(); | ||
var state = test_1.arrange(); | ||
var container = redux ? getReduxProvider(state, test_1.container) : react_test_renderer_1.create(React.createElement(React.Fragment, null, test_1.container)); | ||
var container = react_test_renderer_1.create(React.createElement(React.Fragment, null, test_1.container)); | ||
if (test_1.act) { | ||
@@ -53,0 +41,0 @@ test_1.act(container); |
@@ -8,5 +8,4 @@ import { ContainerTest } from '../types'; | ||
* @param {ContainerTest<TContainer, TState>[]} tests - Array of functions that return test configurations | ||
* @param {bool} [redux=false] - Whether or not the container connects to redux | ||
* @returns {void} | ||
*/ | ||
export declare const testContainer: <TContainer, TState = Record<string, unknown>>(description: string, tests: ContainerTest<TContainer, TState>[], redux?: boolean) => void; | ||
export declare const testContainer: <TContainer, TState = Record<string, unknown>>(description: string, tests: ContainerTest<TContainer, TState>[]) => void; |
import * as React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { create } from 'react-test-renderer'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import thunk from 'redux-thunk'; | ||
/** | ||
@@ -12,3 +9,2 @@ * Build and run tests for your containers from an array of test config building functions | ||
* @param {ContainerTest<TContainer, TState>[]} tests - Array of functions that return test configurations | ||
* @param {bool} [redux=false] - Whether or not the container connects to redux | ||
* @returns {void} | ||
@@ -18,11 +14,3 @@ * @docgen_description_note | ||
*/ | ||
export var testContainer = function (description, tests, redux) { | ||
if (redux === void 0) { redux = false; } | ||
var getReduxProvider = function (state, container) { | ||
// Arrange | ||
var middlewares = [thunk]; | ||
var mockStore = configureMockStore(middlewares); | ||
// Act | ||
return create(React.createElement(Provider, { store: mockStore(state) }, container)); | ||
}; | ||
export var testContainer = function (description, tests) { | ||
afterAll(function () { | ||
@@ -46,3 +34,3 @@ jest.clearAllMocks(); | ||
var state = test_1.arrange(); | ||
var container = redux ? getReduxProvider(state, test_1.container) : create(React.createElement(React.Fragment, null, test_1.container)); | ||
var container = create(React.createElement(React.Fragment, null, test_1.container)); | ||
if (test_1.act) { | ||
@@ -49,0 +37,0 @@ test_1.act(container); |
{ | ||
"name": "react-jester", | ||
"version": "1.2.0", | ||
"version": "1.2.1-beta.0", | ||
"description": "Utils to help more rapidly create Jest tests for React containers, useReducer, Redux, and action creators by reducing boiler plate", | ||
@@ -36,5 +36,2 @@ "main": "lib/es5/index.js", | ||
"dependencies": { | ||
"console-log-it": "^1.1.0", | ||
"redux-mock-store": "^1.5.4", | ||
"redux-thunk": "^2.3.0", | ||
"react-test-renderer": "^17.0.1" | ||
@@ -45,4 +42,6 @@ }, | ||
"react": ">=16.8.0", | ||
"react-redux": ">=6.0.0" | ||
"react-redux": ">=6.0.0", | ||
"redux-mock-store": "^1.5.4", | ||
"redux-thunk": "^2.3.0" | ||
} | ||
} |
@@ -15,3 +15,3 @@ [![Build Status](https://travis-ci.com/TheSpicyMeatball/react-jester.svg?branch=main)](https://travis-ci.com/TheSpicyMeatball/react-jester) | ||
<p><b>Version:</b> 1.2.0</p> | ||
<p><b>Version:</b> 1.2.1-beta.0</p> | ||
@@ -18,0 +18,0 @@ <h2>Summary of Utils</h2> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
29683
6
32
535
0
2
- Removedconsole-log-it@^1.1.0
- Removedredux-mock-store@^1.5.4
- Removedredux-thunk@^2.3.0
- Removedconsole-log-it@1.1.0(transitive)