Click here to Skip to main content
14,265,695 members
Rate this:
Please Sign up or sign in to vote.
I have a function like following, this is a rudux to provide EstateList.

import {render} from "react-dom";
import React from "react";
import {Provider} from "react-redux";
import store from "./Store";
import EstateList from "../estates/estateList/estateList";

function estateList() {
        <Provider store={store}>
            <EstateList />


And EstateList is like this:

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import {connect} from "react-redux";

class EstateList extends Component {
      console.log('this can not be seen');
    render() {...}

const mapStateToProps = (state) => {
    return {
        title: state.subNavReducer.title

const mapDispatchToProps = (dispatch) => {
    return {
        setSubNav: (title) => {
                type: "SET_TITLE",
                payload: title

export default connect(mapStateToProps, mapDispatchToProps)(EstateList);

What I have tried:

I tried to test EstateList, like following:
import {shallow, configure} from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import {expect} from 'chai';

import {Provider} from "react-redux";
import store from "../../../components/store/Store";
import EstateList from "../../../components/estates/estateList/estateList";

describe('estate', function () {
    it('getArticlesFromDatabase ', function () {
        let app = shallow(
            <Provider store={store}>
                <EstateList />

It is success, but class EstateList seems not been run.
Cause I can't see the console when test runing.

How to fix it?
Updated 8-Mar-18 21:27pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100