Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EES-4670 Revert Data Catalogue code removal #5165

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public async Task GetPublicationTree()
var controller = BuildPublicationController(publicationCacheService: publicationCacheService.Object);

publicationCacheService
.Setup(s => s.GetPublicationTree(PublicationTreeFilter.FastTrack))
.Setup(s => s.GetPublicationTree(PublicationTreeFilter.DataCatalogue))
.ReturnsAsync(new List<PublicationTreeThemeViewModel>
{
new()
Expand All @@ -91,7 +91,7 @@ public async Task GetPublicationTree()
}
});

var result = await controller.GetPublicationTree(PublicationTreeFilter.FastTrack);
var result = await controller.GetPublicationTree(PublicationTreeFilter.DataCatalogue);

VerifyAllMocks(publicationCacheService);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public async Task GetPublicationTree_NoCachedTreeExists()

var service = BuildService(publicationService.Object);

var result = await service.GetPublicationTree(PublicationTreeFilter.FastTrack);
var result = await service.GetPublicationTree(PublicationTreeFilter.DataCatalogue);

VerifyAllMocks(PublicBlobCacheService);

Expand Down Expand Up @@ -213,14 +213,60 @@ public async Task GetPublicationTree_CachedTreeExists()

var service = BuildService();

var result = await service.GetPublicationTree(PublicationTreeFilter.FastTrack);
var result = await service.GetPublicationTree(PublicationTreeFilter.DataCatalogue);

VerifyAllMocks(PublicBlobCacheService);

var filteredTree = result.AssertRight();
filteredTree.AssertDeepEqualTo(ListOf(publicationTree));
}

[Fact]
public async Task GetPublicationTree_DataCatalogue_SomeLiveReleaseHasData_Included()
{
var publicationTree = new PublicationTreeThemeViewModel
{
Title = "Theme A",
Topics = new List<PublicationTreeTopicViewModel>
{
new()
{
Title = "Topic A",
Publications = ListOf(new PublicationTreePublicationViewModel
{
Title = "Publication A",
AnyLiveReleaseHasData = true
})
}
}
};

await AssertPublicationTreeUnfiltered(publicationTree, PublicationTreeFilter.DataCatalogue);
}

[Fact]
public async Task GetPublicationTree_DataCatalogue_NoLiveReleaseHasData_Excluded()
{
var publicationTree = new PublicationTreeThemeViewModel
{
Title = "Theme A",
Topics = new List<PublicationTreeTopicViewModel>
{
new()
{
Title = "Topic A",
Publications = ListOf(new PublicationTreePublicationViewModel
{
Title = "Publication A",
AnyLiveReleaseHasData = false
})
}
}
};

await AssertPublicationTreeEmpty(publicationTree, PublicationTreeFilter.DataCatalogue);
}

[Fact]
public async Task GetPublicationTree_DataTables_NonSupersededPublicationWithDataOnLatestRelease_Included()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ private static bool FilterPublicationTreePublication(
{
case PublicationTreeFilter.DataTables:
return publication.LatestReleaseHasData;
case PublicationTreeFilter.DataCatalogue:
case PublicationTreeFilter.FastTrack:
return publication.AnyLiveReleaseHasData;
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#nullable enable

namespace GovUk.Education.ExploreEducationStatistics.Content.Services.Requests
{
public enum PublicationTreeFilter
{
DataTables,
DataCatalogue,
FastTrack,
}
}