feat(objects): ObjectCacheGenerator core + GenObjects command
Wraps introspection, categorization sync, and cache-building into a single file-I/O-free Generate() so the full pipeline is testable without a shard; GenObjects is a thin command that adds file I/O and operator messaging on top. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a55d83fc21
commit
0ac505d7b6
3 changed files with 155 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Xunit;
|
||||
|
||||
namespace UOContent.Tests.Commands.Objects;
|
||||
|
||||
[Collection("Sequential UOContent Tests")]
|
||||
public class ObjectCacheGeneratorTests
|
||||
{
|
||||
[Fact]
|
||||
public void Generate_builds_index_and_chunks_from_extracted_objects()
|
||||
{
|
||||
var discovered = new List<Type> { typeof(Runebook), typeof(Katana) };
|
||||
var categorization = new List<CAGJson>(); // empty -> both land in Items.Uncategorized
|
||||
|
||||
var result = ObjectCacheGenerator.Generate(categorization, discovered);
|
||||
|
||||
Assert.Equal(2, result.Index.Objects.Count);
|
||||
Assert.NotEmpty(result.Chunks);
|
||||
|
||||
var runebook = Assert.Single(result.Index.Objects, o => o.Type == "Runebook");
|
||||
Assert.True(runebook.ItemID > 0);
|
||||
Assert.Equal(1041267, runebook.Cliloc);
|
||||
Assert.Equal("items.uncategorized", runebook.Chunk);
|
||||
|
||||
Assert.Contains("Runebook", result.Report.Appended);
|
||||
Assert.Contains("items.uncategorized", result.Chunks.Keys);
|
||||
Assert.Contains("Runebook", result.Chunks["items.uncategorized"].Keys);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue