How to use the react-router-dom.MemoryRouter function in react-router-dom

To help you get started, we’ve selected a few react-router-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jedireza / aqua / test / client / pages / admin / statuses / search / results.js View on Github external
'use strict';
const Code = require('code');
const Lab = require('lab');
const React = require('react');
const ReactRouter = require('react-router-dom');
const ReactTestUtils = require('react-dom/test-utils');
const Results = require('../../../../../../client/pages/admin/statuses/search/results.jsx');


const lab = exports.lab = Lab.script();
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Admin Statuses Search Results', () => {

    lab.test('it renders with and without a user information', (done) => {

        const props = {
            data: [{
                _id: 'account-happy',
                pivot: 'Account',
                name: 'Happy'
            }, {
                _id: 'account-sad',
                pivot: 'Account',
                name: 'Sad'
            }]
github jedireza / aqua / test / client / pages / admin / admins / details / user-form.js View on Github external
const ReactTestUtils = require('react-dom/test-utils');


const lab = exports.lab = Lab.script();
const stub = {
    Actions: {}
};
const Form = Proxyquire('../../../../../../client/pages/admin/admins/details/user-form.jsx', {
    './actions': stub.Actions
});
const defaultProps = {
    hasError: {},
    help: {},
    id: undefined
};
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Admin Admins User Form', () => {

    lab.test('it renders', (done) => {

        const FormEl = React.createElement(Form, defaultProps);
        const RootEl = React.createElement(MemoryRouter, {}, FormEl);
        const root = ReactTestUtils.renderIntoDocument(RootEl);
        const form = ReactTestUtils.findRenderedComponentWithType(root, Form);

        Code.expect(form).to.exist();

        done();
    });
github jedireza / aqua / test / client / pages / admin / accounts / details / user-form.js View on Github external
const ReactTestUtils = require('react-dom/test-utils');


const lab = exports.lab = Lab.script();
const stub = {
    Actions: {}
};
const Form = Proxyquire('../../../../../../client/pages/admin/accounts/details/user-form.jsx', {
    './actions': stub.Actions
});
const defaultProps = {
    hasError: {},
    help: {},
    id: undefined
};
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Admin Accounts User Form', () => {

    lab.test('it renders', (done) => {

        const FormEl = React.createElement(Form, defaultProps);
        const RootEl = React.createElement(MemoryRouter, {}, FormEl);
        const root = ReactTestUtils.renderIntoDocument(RootEl);
        const form = ReactTestUtils.findRenderedComponentWithType(root, Form);

        Code.expect(form).to.exist();

        done();
    });
github jedireza / aqua / test / client / pages / admin / admins / search / results.js View on Github external
'use strict';
const Code = require('code');
const Lab = require('lab');
const React = require('react');
const ReactRouter = require('react-router-dom');
const ReactTestUtils = require('react-dom/test-utils');
const Results = require('../../../../../../client/pages/admin/admins/search/results.jsx');


const lab = exports.lab = Lab.script();
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Admin Admins Search Results', () => {

    lab.test('it renders with and without a user information', (done) => {

        const props = {
            data: [{
                _id: 'abcxyz',
                name: {
                    first: 'Ren',
                    middle: '',
                    last: 'Hoek'
                }
            }, {
                _id: 'xyzabc',
github jedireza / aqua / test / client / pages / main / not-found.js View on Github external
'use strict';
const Code = require('code');
const Lab = require('lab');
const NotFound = require('../../../../client/pages/main/not-found.jsx');
const React = require('react');
const ReactDOM = require('react-dom');
const ReactRouter = require('react-router-dom');
const ReactTestUtils = require('react-dom/test-utils');


const lab = exports.lab = Lab.script();
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Main Not Found Component', () => {

    let RootEl;

    lab.beforeEach((done) => {

        const NotFoundEl = React.createElement(NotFound, {});

        RootEl = React.createElement(MemoryRouter, {}, NotFoundEl);

        done();
    });
github jedireza / aqua / test / client / pages / main / login / home / index.js View on Github external
const ReactDOM = require('react-dom');
const ReactRouter = require('react-router-dom');
const ReactTestUtils = require('react-dom/test-utils');
const Store = require('../../../../../../client/pages/main/login/home/store');


const lab = exports.lab = Lab.script();
const stub = {
    Actions: {
        getUserCreds: function () {}
    }
};
const Home = Proxyquire('../../../../../../client/pages/main/login/home/index.jsx', {
    '../actions': stub.Actions
});
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Login Home Form', () => {

    let RootEl;

    lab.beforeEach((done) => {

        const HomeEl = React.createElement(Home, {});

        RootEl = React.createElement(MemoryRouter, {}, HomeEl);

        done();
    });
github jedireza / aqua / test / client / pages / admin / not-found.js View on Github external
'use strict';
const Code = require('code');
const Lab = require('lab');
const NotFound = require('../../../../client/pages/admin/not-found.jsx');
const React = require('react');
const ReactDOM = require('react-dom');
const ReactRouter = require('react-router-dom');
const ReactTestUtils = require('react-dom/test-utils');


const lab = exports.lab = Lab.script();
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Admin Not Found Page', () => {

    let RootEl;

    lab.beforeEach((done) => {

        const NotFoundEl = React.createElement(NotFound, {});

        RootEl = React.createElement(MemoryRouter, {}, NotFoundEl);

        done();
    });
github jedireza / aqua / test / client / pages / main / login / reset / index.js View on Github external
const Proxyquire = require('proxyquire');
const React = require('react');
const ReactDOM = require('react-dom');
const ReactRouter = require('react-router-dom');
const ReactTestUtils = require('react-dom/test-utils');
const Store = require('../../../../../../client/pages/main/login/reset/store');


const lab = exports.lab = Lab.script();
const stub = {
    Actions: {}
};
const Reset = Proxyquire('../../../../../../client/pages/main/login/reset/index.jsx', {
    '../actions': stub.Actions
});
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Login Reset Form', () => {

    let RootEl;

    lab.beforeEach((done) => {

        const props = {
            match: {
                params: {
                    email: 'ren@stimpy',
                    key: 'abcxyz'
                }
            }
        };
github jedireza / aqua / test / client / pages / admin / users / details / index.js View on Github external
const Page = Proxyquire('../../../../../../client/pages/admin/users/details/index.jsx', {
    './actions': stub.Actions
});
const container = global.document.createElement('div');
const defaultProps = {
    ref: function () {

        if (defaultProps.ref.impl) {
            defaultProps.ref.impl.apply(null, arguments);
        }
    },
    match: {
        params: {}
    }
};
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Admin Users Details Page', () => {

    let RootEl;

    lab.beforeEach((done) => {

        const PageEl = React.createElement(Page, defaultProps);

        RootEl = React.createElement(MemoryRouter, {}, PageEl);

        done();
    });
github jedireza / aqua / test / client / pages / account / navbar.js View on Github external
'use strict';
const Code = require('code');
const Lab = require('lab');
const Navbar = require('../../../../client/pages/account/navbar.jsx');
const React = require('react');
const ReactDOM = require('react-dom');
const ReactRouter = require('react-router-dom');
const ReactTestUtils = require('react-dom/test-utils');


const lab = exports.lab = Lab.script();
const MemoryRouter = ReactRouter.MemoryRouter;


lab.experiment('Account Navbar', () => {

    let RootEl;

    lab.beforeEach((done) => {

        const NavbarEl = React.createElement(Navbar, {
            location: {}
        });

        RootEl = React.createElement(MemoryRouter, {}, NavbarEl);

        done();
    });