Use database branding for PWA manifest

This commit is contained in:
biss committed 2026-11-21 19:50:31 +08:00
1 parent 0231c468a4
commit ea76ef29ba
4 files changed
+36

No files matched your search

@@ -5,6 +5,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore.Http;
using System.Text.Json;
namespace Jiaowu.Api.Tests;
@@ -37,5 +39,11 @@ public sealed class BusinessSettingsTests
Assert.Equal("NEW", nextRequest.Document().DocumentNumberPrefix);
Assert.Equal(30, nextRequest.Read().GradeAppealWindowDays);
Assert.Single(await db.BusinessSettings.ToListAsync());
var publicController = new BusinessSettingsController(db, nextRequest) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() } };
var manifest = Assert.IsType<JsonResult>(publicController.Manifest());
var manifestJson = JsonSerializer.SerializeToElement(manifest.Value);
Assert.Equal("新产品", manifestJson.GetProperty("name").GetString());
Assert.Equal("新简称", manifestJson.GetProperty("short_name").GetString());
Assert.Equal("no-store", publicController.Response.Headers.CacheControl.ToString());
}
}