Skip to content

Commit

Permalink
fix: fix test for viewing submission
Browse files Browse the repository at this point in the history
  • Loading branch information
katie-gardner committed Nov 28, 2024
1 parent b1539ed commit 38caff1
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ private IEnumerable<List<Submission>> GenerateSubmissionsForSections(Faker faker
submission.Completed = true;
submission.DateCompleted = faker.Date.Future(1, submission.DateCreated);
submission.Maturity = faker.PickRandom(maturities);
submission.Viewed = false;
}

yield return submissions;
Expand Down Expand Up @@ -251,13 +252,18 @@ public async Task GetLatestResponses_Should_Not_Return_Deleted_Submission()
}

[Fact]
public async Task ViewLatestSubmission_Should_Mark_Completed_Submission_As_Viewed()
public async Task ViewLatestSubmission_Should_Mark_Latest_Completed_Submission_As_Viewed()
{
var submission = GetCompletedSubmissionForCompletedSection();
var latestResponse = await _getLatestResponseListForSubmissionQuery.GetLatestResponses(ESTABLISHMENT_ID, submission.SectionId, true);
var latestSubmission = _submissions.FirstOrDefault(sub => sub.Id == latestResponse?.SubmissionId);

Assert.NotNull(latestSubmission);
Assert.False(latestSubmission.Viewed);

await _getLatestResponseListForSubmissionQuery.ViewLatestSubmission(ESTABLISHMENT_ID, submission.SectionId);

Assert.True(submission.Viewed);
Assert.True(latestSubmission.Viewed);
}

[Fact]
Expand Down

0 comments on commit 38caff1

Please sign in to comment.