feat(03-01): create Phase 3 export stubs and test scaffolds
- Add StorageCsvExportService, StorageHtmlExportService stub (Plan 03-03) - Add SearchCsvExportService, SearchHtmlExportService stub (Plan 03-05) - Add DuplicatesHtmlExportService stub (Plan 03-05) - Add StorageServiceTests, SearchServiceTests, DuplicatesServiceTests scaffolds - Add export test scaffolds for all 4 Phase 3 export services - 7 pure-logic tests pass (VersionSizeBytes + MakeKey); 4 CSOM stubs skip
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using SharepointToolbox.Core.Models;
|
||||
using SharepointToolbox.Services.Export;
|
||||
using Xunit;
|
||||
|
||||
namespace SharepointToolbox.Tests.Services.Export;
|
||||
|
||||
public class StorageHtmlExportServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public void BuildHtml_WithNodes_ContainsToggleJs()
|
||||
{
|
||||
var svc = new StorageHtmlExportService();
|
||||
var nodes = new List<StorageNode>
|
||||
{
|
||||
new() { Name = "Shared Documents", Library = "Shared Documents", SiteTitle = "Site1",
|
||||
TotalSizeBytes = 5000, FileStreamSizeBytes = 4000, TotalFileCount = 20,
|
||||
Children = new List<StorageNode>
|
||||
{
|
||||
new() { Name = "Archive", Library = "Shared Documents", SiteTitle = "Site1",
|
||||
TotalSizeBytes = 1000, FileStreamSizeBytes = 800, TotalFileCount = 5 }
|
||||
} }
|
||||
};
|
||||
var html = svc.BuildHtml(nodes);
|
||||
Assert.Contains("toggle(", html);
|
||||
Assert.Contains("<!DOCTYPE html>", html);
|
||||
Assert.Contains("Shared Documents", html);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildHtml_WithEmptyList_ReturnsValidHtml()
|
||||
{
|
||||
var svc = new StorageHtmlExportService();
|
||||
var html = svc.BuildHtml(new List<StorageNode>());
|
||||
Assert.Contains("<!DOCTYPE html>", html);
|
||||
Assert.Contains("<html", html);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildHtml_WithMultipleLibraries_EachLibraryAppearsInOutput()
|
||||
{
|
||||
var svc = new StorageHtmlExportService();
|
||||
var nodes = new List<StorageNode>
|
||||
{
|
||||
new() { Name = "Documents", Library = "Documents", SiteTitle = "Site1", TotalSizeBytes = 1000 },
|
||||
new() { Name = "Images", Library = "Images", SiteTitle = "Site1", TotalSizeBytes = 2000 }
|
||||
};
|
||||
var html = svc.BuildHtml(nodes);
|
||||
Assert.Contains("Documents", html);
|
||||
Assert.Contains("Images", html);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user