mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 16:08:38 +00:00
Simplify filters and make cross control slots not show by default (#782)
* Simplify filters and make cross control slots not show by default Also sort author levels by oldest levels first rather than newest levels first. * Fix unit test expecting slots to sorted by timestamp descending * Remove errant whitespace
This commit is contained in:
parent
2a85b6a136
commit
a69d94054b
20 changed files with 114 additions and 58 deletions
|
@ -271,6 +271,52 @@ public class ControllerExtensionTests
|
|||
Assert.NotEmpty(queryBuilder.GetFilters(typeof(CrossControlFilter)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FilterFromRequest_ShouldAddExcludeCrossControlFilter_WhenCrossControlNotTrue()
|
||||
{
|
||||
GameTokenEntity token = MockHelper.GetUnitTestToken();
|
||||
token.GameVersion = GameVersion.LittleBigPlanet2;
|
||||
SlotsController controller = new(null!)
|
||||
{
|
||||
ControllerContext =
|
||||
{
|
||||
HttpContext = new DefaultHttpContext
|
||||
{
|
||||
Request =
|
||||
{
|
||||
QueryString = new QueryString("?crosscontrol=false"),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
SlotQueryBuilder queryBuilder = controller.FilterFromRequest(token);
|
||||
Assert.NotEmpty(queryBuilder.GetFilters(typeof(ExcludeCrossControlFilter)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FilterFromRequest_ShouldAddExcludeCrossControlFilter_WhenCrossControlMissing()
|
||||
{
|
||||
GameTokenEntity token = MockHelper.GetUnitTestToken();
|
||||
token.GameVersion = GameVersion.LittleBigPlanet2;
|
||||
SlotsController controller = new(null!)
|
||||
{
|
||||
ControllerContext =
|
||||
{
|
||||
HttpContext = new DefaultHttpContext
|
||||
{
|
||||
Request =
|
||||
{
|
||||
QueryString = new QueryString(),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
SlotQueryBuilder queryBuilder = controller.FilterFromRequest(token);
|
||||
Assert.NotEmpty(queryBuilder.GetFilters(typeof(ExcludeCrossControlFilter)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FilterFromRequest_ShouldAddAdventureFilter_WhenAdventureEqualsAllMust()
|
||||
{
|
||||
|
|
|
@ -77,7 +77,7 @@ public class SlotControllerTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public async Task SlotsBy_ResultsAreOrderedByFirstUploadedTimestampDescending()
|
||||
public async Task SlotsBy_ResultsAreOrderedByFirstUploadedTimestampAscending()
|
||||
{
|
||||
List<SlotEntity> slots = new()
|
||||
{
|
||||
|
@ -119,9 +119,9 @@ public class SlotControllerTests
|
|||
IActionResult result = await slotsController.SlotsBy("bytest");
|
||||
|
||||
const int expectedElements = 3;
|
||||
const int expectedFirstSlotId = 1;
|
||||
const int expectedFirstSlotId = 2;
|
||||
const int expectedSecondSlotId = 3;
|
||||
const int expectedThirdSlotId = 2;
|
||||
const int expectedThirdSlotId = 1;
|
||||
|
||||
GenericSlotResponse slotResponse = result.CastTo<OkObjectResult, GenericSlotResponse>();
|
||||
Assert.Equal(expectedElements, slotResponse.Slots.Count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue