Updated various parts of scanning and ingestion, either for bug fixes, or for enhancements.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Domain.Enums;
|
||||
using JSMR.Domain.ValueObjects;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shouldly;
|
||||
|
||||
namespace JSMR.Tests.Ingestion.Japanese;
|
||||
|
||||
public class Update_Upcoming_With_No_Expected_Date_Tests(MariaDbContainerFixture container) : JapaneseIngestionTestsBase(container)
|
||||
{
|
||||
[Fact]
|
||||
public async Task Update_Upcoming_With_No_Expected_Date()
|
||||
{
|
||||
VoiceWorkIngest ingest = new()
|
||||
{
|
||||
MakerId = "RG00001",
|
||||
MakerName = "Some Maker",
|
||||
ProductId = "RJ1000001",
|
||||
Title = "Some Upcoming Work",
|
||||
Description = "Something is coming.",
|
||||
Tags = [],
|
||||
Creators = [],
|
||||
WishlistCount = 250,
|
||||
Downloads = 0,
|
||||
HasTrial = false,
|
||||
HasDLPlay = false,
|
||||
StarRating = null,
|
||||
Votes = null,
|
||||
AgeRating = AgeRating.R15,
|
||||
HasImage = true,
|
||||
SupportedLanguages = [SupportedLanguage.Japanese],
|
||||
SalesDate = null,
|
||||
ExpectedDate = new DateOnly(2025, 1, 21),
|
||||
RegistrationDate = null
|
||||
};
|
||||
|
||||
await using AppDbContext dbContext = await GetAppDbContextAsync();
|
||||
DateTime currentDateTime = TokyoLocalToUtc(2025, 01, 05, 10, 0, 0);
|
||||
|
||||
await UpsertAndVerify(dbContext, TokyoLocalToUtc(2025, 01, 05, 10, 0, 0), ingest, new DateTime(2025, 1, 21));
|
||||
|
||||
VoiceWorkIngest updatedIngest = ingest with
|
||||
{
|
||||
ExpectedDate = null
|
||||
};
|
||||
|
||||
// Should be exactly the same
|
||||
await UpsertAndVerify(dbContext, TokyoLocalToUtc(2025, 01, 05, 10, 0, 0), ingest, new DateTime(2025, 1, 21));
|
||||
}
|
||||
|
||||
private static async Task UpsertAndVerify(AppDbContext dbContext, DateTime dateTime, VoiceWorkIngest ingest, DateTime? expectedDate)
|
||||
{
|
||||
await UpsertAsync(dbContext, dateTime, [ingest]);
|
||||
|
||||
VoiceWork? voiceWork = await dbContext.VoiceWorks.SingleAsync(v => v.ProductId == ingest.ProductId, TestContext.Current.CancellationToken);
|
||||
voiceWork.ShouldNotBeNull();
|
||||
voiceWork.ExpectedDate.ShouldBe(expectedDate);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,7 @@
|
||||
using JSMR.Application.Common;
|
||||
using JSMR.Application.Scanning.Contracts;
|
||||
using JSMR.Application.Scanning.Ports;
|
||||
using JSMR.Domain.Entities;
|
||||
using JSMR.Infrastructure.Common.Time;
|
||||
using JSMR.Infrastructure.Data;
|
||||
using JSMR.Infrastructure.Ingestion;
|
||||
using JSMR.Tests.Fixtures;
|
||||
using JSMR.Tests.Ingestion.Japanese;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NSubstitute;
|
||||
using Shouldly;
|
||||
using JSMR.Tests.Fixtures;
|
||||
|
||||
namespace JSMR.Tests.Ingestion;
|
||||
|
||||
|
||||
|
||||
public class VoiceWorkIngestionTests(MariaDbContainerFixture container) : IngestionTestsBase(container)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user