UI 복잡 버전 234 RED→GREEN 완료(docs/UI_USECASES.md §A~§J): 라이브 테마 전환(DynamicResource 전환+ThemeResolver+HighContrast 테마, 재시작 없음), 디자인 토큰 체계·WCAG 대비 결함 5건 수정, 설정창 카테고리 내비/검색 재구성+AppConfig 40여 속성, 다운로드 관리자(속도/ETA/세그먼트맵/전체 일시정지-이어받기/CSV 내보내기/예약 게이트/중복 확인), 라이브러리·아카이브·작업공간·재생목록·즐겨찾기 편집 뷰, 접근성(자동화 속성 30여 개·커스텀 피어·docs/ACCESSIBILITY.md), 인터랙션(휠 클릭 새 탭·XButton 탐색·F12·영역 캡처·프로필 전환), 상태/알림(토스트·알림센터·온보딩·CrashReportDialog). 보강 테스트 35건+실창 E2E 4건(StaDispatcher 기반 — 프록시 설정이 기시작 핸들러를 건드리는 크래시 실결함 수정 포함) — 453/453 GREEN. 이전 미커밋 작업(CI 워크플로·Mdns·QueueHub·UpdateChecker·AGENTS/CLAUDE·빌드 스크립트) 일괄 포함
This commit is contained in:
parent
5a0ce730b2
commit
17f2f91152
88 changed files with 9463 additions and 1127 deletions
102
VideoDownloader.Tests/Platform/UpdateCheckerTests.cs
Normal file
102
VideoDownloader.Tests/Platform/UpdateCheckerTests.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using VideoDownloader.Core.Update;
|
||||
|
||||
namespace VideoDownloader.Tests.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// DEPLOYMENT_PLAN §6 자동 업데이트 v1 — GitHub Releases latest 태그 비교 + 아키텍처별 설치 자산 선택.
|
||||
/// 네트워크는 가짜 핸들러로 격리.
|
||||
/// </summary>
|
||||
public class UpdateCheckerTests
|
||||
{
|
||||
private sealed class FakeHandler : HttpMessageHandler
|
||||
{
|
||||
private readonly HttpStatusCode _status;
|
||||
private readonly string _json;
|
||||
public HttpRequestMessage? LastRequest { get; private set; }
|
||||
|
||||
public FakeHandler(HttpStatusCode status, string json)
|
||||
{
|
||||
_status = status;
|
||||
_json = json;
|
||||
}
|
||||
|
||||
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken ct)
|
||||
{
|
||||
LastRequest = request;
|
||||
return Task.FromResult(new HttpResponseMessage(_status)
|
||||
{
|
||||
Content = new StringContent(_json, System.Text.Encoding.UTF8, "application/json"),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private const string ReleaseJson = """
|
||||
{
|
||||
"tag_name": "v1.2.0",
|
||||
"html_url": "https://github.com/user/videodownloader/releases/tag/v1.2.0",
|
||||
"assets": [
|
||||
{ "name": "VideoDownloader-Setup-x64.exe", "browser_download_url": "https://github.com/user/videodownloader/releases/download/v1.2.0/VideoDownloader-Setup-x64.exe" },
|
||||
{ "name": "VideoDownloader-Setup-arm64.exe", "browser_download_url": "https://github.com/user/videodownloader/releases/download/v1.2.0/VideoDownloader-Setup-arm64.exe" }
|
||||
]
|
||||
}
|
||||
""";
|
||||
|
||||
[Theory]
|
||||
[InlineData("1.0.0", "v1.2.0", true)] // 최신이 더 높음
|
||||
[InlineData("1.2.0", "v1.2.0", false)] // 동일
|
||||
[InlineData("2.0.0", "v1.9.9", false)] // 현재가 더 높음
|
||||
[InlineData("1.0.0.0", "v1.0.1", true)] // 어셈블리 4자리 버전 허용
|
||||
[InlineData("1.0.0", "garbage", false)] // 파싱 불가면 갱신 아님
|
||||
public void 버전비교(string current, string latest, bool expected) =>
|
||||
Assert.Equal(expected, UpdateChecker.IsNewer(current, latest));
|
||||
|
||||
[Fact]
|
||||
public void 자산선택_x64와_arm64_구분()
|
||||
{
|
||||
var assets = new[]
|
||||
{
|
||||
new UpdateAsset("VideoDownloader-Setup-x64.exe", "https://dl/x64"),
|
||||
new UpdateAsset("VideoDownloader-Setup-arm64.exe", "https://dl/arm64"),
|
||||
};
|
||||
|
||||
Assert.Equal("https://dl/x64", UpdateChecker.SelectAsset(assets, "win-x64")!.DownloadUrl);
|
||||
Assert.Equal("https://dl/arm64", UpdateChecker.SelectAsset(assets, "win-arm64")!.DownloadUrl);
|
||||
Assert.Null(UpdateChecker.SelectAsset(assets, "linux-x64")); // 일치 없음
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task 최신확인_새버전이면_자산과_릴리스URL()
|
||||
{
|
||||
var handler = new FakeHandler(HttpStatusCode.OK, ReleaseJson);
|
||||
var checker = new UpdateChecker(handler);
|
||||
|
||||
var result = await checker.CheckAsync("user/videodownloader", "1.0.0", "win-x64");
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result!.IsNewer);
|
||||
Assert.Equal("1.2.0", result.LatestVersion);
|
||||
Assert.Equal("https://github.com/user/videodownloader/releases/tag/v1.2.0", result.ReleaseUrl);
|
||||
Assert.Equal("VideoDownloader-Setup-x64.exe", result.Asset!.Name);
|
||||
|
||||
// GitHub API 규약: User-Agent 필수 + 올바른 엔드포인트
|
||||
Assert.Equal("https://api.github.com/repos/user/videodownloader/releases/latest", handler.LastRequest!.RequestUri!.ToString());
|
||||
Assert.NotEmpty(handler.LastRequest.Headers.UserAgent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task 최신확인_이미_최신이면_IsNewer_false()
|
||||
{
|
||||
var checker = new UpdateChecker(new FakeHandler(HttpStatusCode.OK, ReleaseJson));
|
||||
var result = await checker.CheckAsync("user/videodownloader", "1.2.0", "win-x64");
|
||||
Assert.False(result!.IsNewer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task 최신확인_API_실패는_예외로_드러남()
|
||||
{
|
||||
var checker = new UpdateChecker(new FakeHandler(HttpStatusCode.NotFound, """{"message":"Not Found"}"""));
|
||||
await Assert.ThrowsAsync<HttpRequestException>(() => checker.CheckAsync("user/none", "1.0.0", "win-x64"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue