Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccallum committed Apr 27, 2021
1 parent b1389e2 commit c81a552
Showing 1 changed file with 45 additions and 24 deletions.
69 changes: 45 additions & 24 deletions src/FairyBread.Tests/InputValidationMiddlewareTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,51 @@ public async Task Mutation_Validates_By_Default()
await Verifier.Verify(result);
}

// TODO: Fix
//[Fact]
//public async Task Multi_TopLevelFields_And_MultiRuns_Works()
//{
// // Arrange
// var executor = await GetRequestExecutorAsync(options =>
// {
// options.ShouldValidate = (ctx, arg) => ctx.Operation.Operation == OperationType.Query;
// });

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

// // Act
// var result1 = await executor.ExecuteAsync(query);
// var result2 = await executor.ExecuteAsync(query);
// var result3 = await executor.ExecuteAsync(query);

// // Assert
// await Verifier.Verify(new { result1, result2, result3 });
//}
[Fact]
public async Task Multi_TopLevelFields_And_MultiRuns_Works()
{
// Arrange
var executor = await GetRequestExecutorAsync(options =>
{
options.ShouldValidate = (ctx, arg) => ctx.Operation.Operation == OperationType.Query;
});

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

// Act
IExecutionResult result1;
using (executor.Services.CreateScope())
{
result1 = await executor.ExecuteAsync(query);
}

IExecutionResult result2;
using (executor.Services.CreateScope())
{
executor = await GetRequestExecutorAsync(options =>
{
options.ShouldValidate = (ctx, arg) => ctx.Operation.Operation == OperationType.Query;
});
result2 = await executor.ExecuteAsync(query);
}

IExecutionResult result3;
using (executor.Services.CreateScope())
{
executor = await GetRequestExecutorAsync(options =>
{
options.ShouldValidate = (ctx, arg) => ctx.Operation.Operation == OperationType.Query;
});
result3 = await executor.ExecuteAsync(query);
}

// Assert
await Verifier.Verify(new { result1, result2, result3 });
}

[Fact]
public async Task Ignores_Null_Argument_Value()
Expand Down

0 comments on commit c81a552

Please sign in to comment.