Skip to content

Commit

Permalink
Update unit tests in response to 977780c
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel15 committed Oct 10, 2016
1 parent 977780c commit 37c99b9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/React.Tests/Core/ReactComponentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public void RenderHtmlShouldThrowExceptionIfComponentDoesNotExist()
{
var environment = new Mock<IReactEnvironment>();
environment.Setup(x => x.Execute<bool>("typeof Foo !== 'undefined'")).Returns(false);
var component = new ReactComponent(environment.Object, null, "Foo", "container");
var config = new Mock<IReactSiteConfiguration>();
config.Setup(x => x.UseServerSideRendering).Returns(true);
var component = new ReactComponent(environment.Object, config.Object, "Foo", "container");

Assert.Throws<ReactInvalidComponentException>(() =>
{
Expand All @@ -35,6 +37,7 @@ public void RenderHtmlShouldCallRenderComponent()
var environment = new Mock<IReactEnvironment>();
environment.Setup(x => x.Execute<bool>("typeof Foo !== 'undefined'")).Returns(true);
var config = new Mock<IReactSiteConfiguration>();
config.Setup(x => x.UseServerSideRendering).Returns(true);

var component = new ReactComponent(environment.Object, config.Object, "Foo", "container")
{
Expand All @@ -53,6 +56,7 @@ public void RenderHtmlShouldWrapComponentInDiv()
environment.Setup(x => x.Execute<string>(@"ReactDOMServer.renderToString(React.createElement(Foo, {""hello"":""World""}))"))
.Returns("[HTML]");
var config = new Mock<IReactSiteConfiguration>();
config.Setup(x => x.UseServerSideRendering).Returns(true);

var component = new ReactComponent(environment.Object, config.Object, "Foo", "container")
{
Expand Down Expand Up @@ -88,6 +92,7 @@ public void RenderHtmlShouldNotRenderClientSideAttributes()
var environment = new Mock<IReactEnvironment>();
environment.Setup(x => x.Execute<bool>("typeof Foo !== 'undefined'")).Returns(true);
var config = new Mock<IReactSiteConfiguration>();
config.Setup(x => x.UseServerSideRendering).Returns(true);

var component = new ReactComponent(environment.Object, config.Object, "Foo", "container")
{
Expand All @@ -102,6 +107,7 @@ public void RenderHtmlShouldNotRenderClientSideAttributes()
public void RenderHtmlShouldWrapComponentInCustomElement()
{
var config = new Mock<IReactSiteConfiguration>();
config.Setup(x => x.UseServerSideRendering).Returns(true);
var environment = new Mock<IReactEnvironment>();
environment.Setup(x => x.Execute<bool>("typeof Foo !== 'undefined'")).Returns(true);
environment.Setup(x => x.Execute<string>(@"ReactDOMServer.renderToString(React.createElement(Foo, {""hello"":""World""}))"))
Expand All @@ -121,6 +127,7 @@ public void RenderHtmlShouldWrapComponentInCustomElement()
public void RenderHtmlShouldAddClassToElement()
{
var config = new Mock<IReactSiteConfiguration>();
config.Setup(x => x.UseServerSideRendering).Returns(true);
var environment = new Mock<IReactEnvironment>();
environment.Setup(x => x.Execute<bool>("typeof Foo !== 'undefined'")).Returns(true);
environment.Setup(x => x.Execute<string>(@"ReactDOMServer.renderToString(React.createElement(Foo, {""hello"":""World""}))"))
Expand Down

0 comments on commit 37c99b9

Please sign in to comment.