From f93c4d2f72adc16d9dc504d2575f3921d05844bb Mon Sep 17 00:00:00 2001 From: plockwood Date: Tue, 19 Dec 2023 16:07:55 +0000 Subject: [PATCH] test fixes --- .../Features/ApiClient.cs | 2 +- .../Features/IApiClient.cs | 2 +- .../AcademyConversionProjectRepository.cs | 4 ++-- .../Pages/BaseIntegrationTests.MockData.cs | 10 ++++---- .../ProjectListFilteringIntegrationTests.cs | 23 ++++--------------- .../Pages/Shared/_ProjectListFilters.cshtml | 2 +- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/ApiClient.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/ApiClient.cs index 366912c31..d9c8f4b14 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/ApiClient.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/ApiClient.cs @@ -29,7 +29,7 @@ public async Task GetAllProjectsAsync(AcademyConversionSear { return await AcademisationClient.PostAsync(PathFor.GetAllProjects, JsonContent.Create(searchModel)); } - public async Task DownloadProjectExport(AcademyConversionSearchModel searchModel) + public async Task DownloadProjectExport(AcademyConversionSearchModelV2 searchModel) { return await AcademisationClient.PostAsync(PathFor.DownloadProjectExport, JsonContent.Create(searchModel)); } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/IApiClient.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/IApiClient.cs index e2a5755ce..327250d0c 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/IApiClient.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Features/IApiClient.cs @@ -7,7 +7,7 @@ namespace Dfe.PrepareConversions.Data.Features; public interface IApiClient { Task GetAllProjectsAsync(AcademyConversionSearchModel searchModel); - Task DownloadProjectExport(AcademyConversionSearchModel searchModel); + Task DownloadProjectExport(AcademyConversionSearchModelV2 searchModel); Task GetAllProjectsV2Async(AcademyConversionSearchModelV2 searchModel); Task GetProjectByIdAsync(int id); Task UpdateProjectAsync(int id, UpdateAcademyConversionProject updateProject); diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs index d7e2b3272..79cb7e905 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Data/Services/AcademyConversionProjectRepository.cs @@ -142,9 +142,9 @@ public async Task> DownloadProjectExport( IEnumerable regionsFilter = default, IEnumerable applicationReferences = default) { - AcademyConversionSearchModel searchModel = new() { TitleFilter = titleFilter, Page = page, Count = count }; + AcademyConversionSearchModelV2 searchModel = new() { TitleFilter = titleFilter, Page = page, Count = count }; - ProcessFilters(statusFilters, deliveryOfficerFilter, searchModel, regionsFilter, applicationReferences); + ProcessFiltersV2(statusFilters, deliveryOfficerFilter, searchModel, regionsFilter, applicationReferences); HttpResponseMessage response = await _apiClient.DownloadProjectExport(searchModel); if (!response.IsSuccessStatusCode) diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs index e29df88f4..2fd9a230b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/BaseIntegrationTests.MockData.cs @@ -22,7 +22,7 @@ public abstract partial class BaseIntegrationTests protected IEnumerable AddGetProjects(Action postSetup = null, int? recordCount = null, - AcademyConversionSearchModel searchModel = null) + AcademyConversionSearchModelV2 searchModel = null) { List projects = _fixture .Build() @@ -41,17 +41,19 @@ protected IEnumerable AddGetProjects(Action(), DeliveryOfficerQueryString = Array.Empty(), - RegionQueryString = Array.Empty() + RegionQueryString = Array.Empty(), + LocalAuthoritiesQueryString = Array.Empty(), + AdvisoryBoardDatesQueryString = Array.Empty() }; - _factory.AddPostWithJsonRequest(PathFor.GetAllProjects, searchModel, response); + _factory.AddPostWithJsonRequest(PathFor.GetAllProjectsV2, searchModel, response); return projects; } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListFilteringIntegrationTests.cs b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListFilteringIntegrationTests.cs index 20799f782..84790464b 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListFilteringIntegrationTests.cs +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions.Tests/Pages/ProjectList/ProjectListFilteringIntegrationTests.cs @@ -54,12 +54,6 @@ public void Should_display_all_projects_by_default() FilterCount.TextContent.Should().NotContainEquivalentOf("Filtered projects"); } - [Fact] - public void Should_not_display_the_filter_options_by_default() - { - FilterOptions.HasAttribute("open").Should().BeFalse(); - } - [Fact] public async Task Should_display_filtered_banner_when_filter_is_active() { @@ -70,26 +64,19 @@ public async Task Should_display_filtered_banner_when_filter_is_active() FilterBanner.InnerHtml.Should().ContainEquivalentOf("Projects filtered."); } - [Fact] - public async Task Should_keep_filter_options_visible_when_filter_is_active() - { - FilterStatuses.First().IsChecked = true; - await FilterApply.SubmitAsync(); - - FilterOptions.HasAttribute("open").Should().BeTrue(); - } - [Fact] public async Task Should_display_filtered_projects_in_place_of_all_projects_when_filter_is_active() { - AcademyConversionSearchModel searchModel = new() + AcademyConversionSearchModelV2 searchModel = new() { Page = 1, Count = 10, StatusQueryString = new[] { "Accepted" }, TitleFilter = string.Empty, DeliveryOfficerQueryString = Array.Empty(), - RegionQueryString = Array.Empty() + RegionQueryString = Array.Empty(), + LocalAuthoritiesQueryString = Array.Empty(), + AdvisoryBoardDatesQueryString = Array.Empty(), }; AddGetProjects(recordCount: _recordCount, searchModel: searchModel); @@ -106,7 +93,7 @@ public async Task Should_keep_the_filter_options_visible_when_title_filter_is_sp FilterTitle.Value = "something"; await FilterApply.SubmitAsync(); - FilterOptions.HasAttribute("open").Should().BeTrue(); + FilterTitle.Value.Should().Be("something"); } diff --git a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListFilters.cshtml b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListFilters.cshtml index 4bd722fea..66d16e8a4 100644 --- a/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListFilters.cshtml +++ b/Dfe.PrepareConversions/Dfe.PrepareConversions/Pages/Shared/_ProjectListFilters.cshtml @@ -101,7 +101,7 @@
-