Skip to content

Commit

Permalink
Refactor common assertions about project creation
Browse files Browse the repository at this point in the history
  • Loading branch information
rmunn committed Aug 22, 2024
1 parent a5b5449 commit 0af5fb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/LfMerge.Core.Tests/E2E/E2ETestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ public async Task<string> CreateEmptyFlexProjectInLexbox()
MercurialTestHelper.CreateFlexRepo(testPath);
// Now create project in LexBox
var result = await TestEnv.CreateLexBoxProject(testCode, randomGuid);
Assert.That(result.Result, Is.EqualTo(LexboxGraphQLTypes.CreateProjectResult.Created));
Assert.That(result.Id, Is.EqualTo(randomGuid));
var pushUrl = SRTestEnvironment.LexboxUrlForProjectWithAuth(testCode).AbsoluteUri;
MercurialTestHelper.HgPush(testPath, pushUrl);
ProjectIdToDelete = result.Id;
Expand All @@ -175,8 +173,6 @@ public async Task<string> CreateNewProjectFromTemplate(string origZipPath)
var testPath = TestFolderForProject(testCode);
// Now create project in LexBox
var result = await TestEnv.CreateLexBoxProject(testCode, randomGuid);
Assert.That(result.Result, Is.EqualTo(LexboxGraphQLTypes.CreateProjectResult.Created));
Assert.That(result.Id, Is.EqualTo(randomGuid));
await TestEnv.ResetAndUploadZip(testCode, origZipPath);
ProjectIdToDelete = result.Id;
return testCode;
Expand Down
9 changes: 6 additions & 3 deletions src/LfMerge.Core.Tests/SRTestEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ ... on DbError {
Query = mutation,
Variables = new { input },
};
var response = await GqlClient.SendMutationAsync<LexboxGraphQLTypes.CreateProjectGqlResponse>(request);
Assert.That(response.Errors, Is.Null.Or.Empty, () => string.Join("\n", response.Errors.Select(error => error.Message)));
return response.Data.CreateProject.CreateProjectResponse;
var gqlResponse = await GqlClient.SendMutationAsync<LexboxGraphQLTypes.CreateProjectGqlResponse>(request);
Assert.That(gqlResponse.Errors, Is.Null.Or.Empty, () => string.Join("\n", gqlResponse.Errors.Select(error => error.Message)));
var response = gqlResponse.Data.CreateProject.CreateProjectResponse;
Assert.That(response.Result, Is.EqualTo(LexboxGraphQLTypes.CreateProjectResult.Created));
Assert.That(response.Id, Is.EqualTo(projId));
return response;
}

public async Task DeleteLexBoxProject(Guid projectId)
Expand Down

0 comments on commit 0af5fb2

Please sign in to comment.