Skip to content

Commit

Permalink
Fixed slow Neo4j tests (#4974)
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSenn committed Apr 17, 2022
1 parent 4281079 commit a35374f
Show file tree
Hide file tree
Showing 149 changed files with 294 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

namespace HotChocolate.Data.Neo4J.Filtering;

[Collection("Database")]
public class Neo4JBooleanFilterTests
: IClassFixture<Neo4JFixture>
{
private readonly Neo4JFixture _fixture;

Expand All @@ -16,30 +16,30 @@ public Neo4JBooleanFilterTests(Neo4JFixture fixture)
}

private readonly string _fooEntitiesCypher =
@"CREATE (:Foo {Bar: true}), (:Foo {Bar: false})";
@"CREATE (:FooBool {Bar: true}), (:FooBool {Bar: false})";
private readonly string _fooEntitiesNullableCypher =
@"CREATE
(:FooNullable {Bar: true}),
(:FooNullable {Bar: false}),
(:FooNullable {Bar: NULL})";
(:FooBoolNullable {Bar: true}),
(:FooBoolNullable {Bar: false}),
(:FooBoolNullable {Bar: NULL})";

public class Foo
public class FooBool
{
public bool Bar { get; set; }
}

public class FooNullable
public class FooBoolNullable
{
public bool? Bar { get; set; }
}

public class FooFilterType
: FilterInputType<Foo>
public class FooBoolFilterType
: FilterInputType<FooBool>
{
}

public class FooNullableFilterType
: FilterInputType<FooNullable>
public class FooBoolNullableFilterType
: FilterInputType<FooBoolNullable>
{
}

Expand All @@ -48,7 +48,7 @@ public async Task Create_BooleanEqual_Expression()
{
// arrange
IRequestExecutor tester =
await _fixture.GetOrCreateSchema<Foo, FooFilterType>(_fooEntitiesCypher);
await _fixture.GetOrCreateSchema<FooBool, FooBoolFilterType>(_fooEntitiesCypher);

// act
const string query1 = "{ root(where: { bar: { eq: true}}){ bar }}";
Expand All @@ -73,7 +73,7 @@ public async Task Create_And_BooleanEqual_Expression()
{
// arrange
IRequestExecutor tester =
await _fixture.GetOrCreateSchema<Foo, FooFilterType>(_fooEntitiesCypher);
await _fixture.GetOrCreateSchema<FooBool, FooBoolFilterType>(_fooEntitiesCypher);

// act
const string query1 =
Expand All @@ -92,7 +92,7 @@ public async Task Create_Or_BooleanEqual_Expression()
{
// arrange
IRequestExecutor tester =
await _fixture.GetOrCreateSchema<Foo, FooFilterType>(_fooEntitiesCypher);
await _fixture.GetOrCreateSchema<FooBool, FooBoolFilterType>(_fooEntitiesCypher);

// act
const string query1 =
Expand All @@ -111,7 +111,7 @@ public async Task Create_BooleanNotEqual_Expression()
{
// arrange
IRequestExecutor tester =
await _fixture.GetOrCreateSchema<Foo, FooFilterType>(_fooEntitiesCypher);
await _fixture.GetOrCreateSchema<FooBool, FooBoolFilterType>(_fooEntitiesCypher);

// act
const string query1 = "{ root(where: { bar: { neq: true}}){ bar}}";
Expand All @@ -136,7 +136,7 @@ public async Task Create_NullableBooleanEqual_Expression()
{
// arrange
IRequestExecutor tester =
await _fixture.GetOrCreateSchema<FooNullable, FooNullableFilterType>(
await _fixture.GetOrCreateSchema<FooBoolNullable, FooBoolNullableFilterType>(
_fooEntitiesNullableCypher);

// act
Expand Down Expand Up @@ -169,7 +169,7 @@ public async Task Create_NullableBooleanNotEqual_Expression()
{
// arrange
IRequestExecutor tester =
await _fixture.GetOrCreateSchema<FooNullable, FooNullableFilterType>(
await _fixture.GetOrCreateSchema<FooBoolNullable, FooBoolNullableFilterType>(
_fooEntitiesNullableCypher);

// act
Expand All @@ -196,4 +196,4 @@ public async Task Create_NullableBooleanNotEqual_Expression()
res2.MatchDocumentSnapshot("false");
res3.MatchDocumentSnapshot("null");
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (foo:Foo) WHERE (foo.Bar = True AND foo.Bar = False) RETURN foo {.Bar}
MATCH (fooBool:FooBool) WHERE (fooBool.Bar = True AND fooBool.Bar = False) RETURN fooBool {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (foo:Foo) WHERE foo.Bar = False RETURN foo {.Bar}
MATCH (fooBool:FooBool) WHERE fooBool.Bar = False RETURN fooBool {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (foo:Foo) WHERE foo.Bar = True RETURN foo {.Bar}
MATCH (fooBool:FooBool) WHERE fooBool.Bar = True RETURN fooBool {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (foo:Foo) WHERE foo.Bar <> False RETURN foo {.Bar}
MATCH (fooBool:FooBool) WHERE fooBool.Bar <> False RETURN fooBool {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (foo:Foo) WHERE foo.Bar <> True RETURN foo {.Bar}
MATCH (fooBool:FooBool) WHERE fooBool.Bar <> True RETURN fooBool {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (fooNullable:FooNullable) WHERE fooNullable.Bar = False RETURN fooNullable {.Bar}
MATCH (fooBoolNullable:FooBoolNullable) WHERE fooBoolNullable.Bar = False RETURN fooBoolNullable {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (fooNullable:FooNullable) WHERE fooNullable.Bar = NULL RETURN fooNullable {.Bar}
MATCH (fooBoolNullable:FooBoolNullable) WHERE fooBoolNullable.Bar = NULL RETURN fooBoolNullable {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (fooNullable:FooNullable) WHERE fooNullable.Bar = True RETURN fooNullable {.Bar}
MATCH (fooBoolNullable:FooBoolNullable) WHERE fooBoolNullable.Bar = True RETURN fooBoolNullable {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (fooNullable:FooNullable) WHERE fooNullable.Bar <> False RETURN fooNullable {.Bar}
MATCH (fooBoolNullable:FooBoolNullable) WHERE fooBoolNullable.Bar <> False RETURN fooBoolNullable {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (fooNullable:FooNullable) WHERE fooNullable.Bar <> NULL RETURN fooNullable {.Bar}
MATCH (fooBoolNullable:FooBoolNullable) WHERE fooBoolNullable.Bar <> NULL RETURN fooBoolNullable {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (fooNullable:FooNullable) WHERE fooNullable.Bar <> True RETURN fooNullable {.Bar}
MATCH (fooBoolNullable:FooBoolNullable) WHERE fooBoolNullable.Bar <> True RETURN fooBoolNullable {.Bar}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MATCH (foo:Foo) WHERE (foo.Bar = True OR foo.Bar = False) RETURN foo {.Bar}
MATCH (fooBool:FooBool) WHERE (fooBool.Bar = True OR fooBool.Bar = False) RETURN fooBool {.Bar}

0 comments on commit a35374f

Please sign in to comment.