Skip to content

Commit

Permalink
Fix test scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccallum committed Jun 26, 2021
1 parent 57062e3 commit ce79d1a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
Errors: [
{
Message: 'Some Integer' must be equal to '1'.,
Code: FairyBread_ValidationError,
Path: {
Name: someResolver
},
Extensions: {
code: FairyBread_ValidationError,
errorCode: EqualValidator,
errorMessage: 'Some Integer' must be equal to '1'.,
propertyName: SomeInteger,
attemptedValue: -1,
severity: Error,
formattedMessagePlaceholderValues: {
ComparisonValue: 1,
ComparisonProperty: ,
PropertyName: Some Integer,
PropertyValue: -1
}
}
}
]
}
7 changes: 6 additions & 1 deletion src/FairyBread.Tests/ValidationMiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public async Task Doesnt_Call_Field_Resolver_If_Invalid()
// Arrange
var executor = await GetRequestExecutorAsync();

var query = @"query { read(foo: { someInteger: -1, someString: ""hello"" }) }";
var query = @"query { someResolver(foo: { someInteger: -1, someString: ""hello"" }) }";

// Act
var result = await executor.ExecuteAsync(query);
Expand Down Expand Up @@ -234,6 +234,11 @@ public class QueryType
public static bool WasFieldResolverCalled { get; private set; }

public string Read(FooInputDto foo, BarInputDto? bar)
{
return $"{foo}; {bar}";
}

public string SomeResolver(FooInputDto foo, BarInputDto? bar)
{
WasFieldResolverCalled = true;
return $"{foo}; {bar}";
Expand Down

0 comments on commit ce79d1a

Please sign in to comment.