Skip to content

Commit

Permalink
mock analytics in rts test
Browse files Browse the repository at this point in the history
  • Loading branch information
ehg committed Feb 18, 2016
1 parent 2c6f0f0 commit 0c9eccf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/pages/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@
import { assert } from 'chai';
import React from 'react';
import ReactDomServer from 'react-dom/server';
import mockery from 'mockery';
import noop from 'lodash/noop';

/**
* Internal dependencies
*/
import { createReduxStore } from 'state';

describe( 'Server pages:', function() {
context( 'when trying to renderToString() LayoutLoggedOutDesign ', function() {
before( function() {
mockery.enable( {
warnOnReplace: false,
warnOnUnregistered: false
} );

mockery.registerMock( 'analytics', noop );

const LayoutLoggedOutDesign = require( 'layout/logged-out-design' );
this.LayoutLoggedOutDesignFactory = React.createFactory( LayoutLoggedOutDesign );
this.props = {
Expand All @@ -17,6 +30,10 @@ describe( 'Server pages:', function() {
};
} );

after( function() {
mockery.deregisterAll();
} );

it( "doesn't throw an exception", function() {
assert.doesNotThrow( ReactDomServer.renderToString.bind( ReactDomServer, this.LayoutLoggedOutDesignFactory( this.props ) ) );
} );
Expand Down

0 comments on commit 0c9eccf

Please sign in to comment.