feat(ads/seo/release): v1.2.0 with live Google Ads, isolated ad profile, ads.txt, and SEO/AEO/GEO optimization

This commit is contained in:
Yun Chan 2026-09-14 00:39:44 +09:00
parent a88aafa1e5
commit 0e568f1f0a
975 changed files with 130593 additions and 16783 deletions

View file

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using Paca.Mobile.Core;
using Paca.Tests.Infrastructure;
using Xunit;
namespace Paca.Tests.Core;
/// <summary>
/// Gate 171 ~ 174: 기기 교체 및 무결성 보장을 위한 Paca Vault 스냅샷 백업 & 복원 엔진 기계적 검증
/// </summary>
public class PacaVaultBackupRestoreGateTests
{
[Fact]
public void Gate171_VaultSnapshot_Creation_And_Integrity()
{
var favorites = new List<string> { "https://youtu.be/abc", "https://x.com/def" };
var queueUrls = new List<string> { "https://chzzk.naver.com/video/1" };
var snapshot = PacaVaultSnapshot.Create("device-alpha", favorites, queueUrls);
Assert.Equal("device-alpha", snapshot.SourceDeviceId);
Assert.Equal(2, snapshot.Favorites.Count);
Assert.Single(snapshot.QueueUrls);
Assert.True(snapshot.VerifyChecksum());
// 조작된 스냅샷 체크섬 검증 실패
var tampered = snapshot with { Favorites = new List<string> { "https://malicious.com" } };
Assert.False(tampered.VerifyChecksum());
}
[Fact]
public void Gate172_VaultSnapshot_Corrupted_ThrowsException()
{
var invalidJson = "{\"SourceDeviceId\":\"x\",\"Checksum\":\"invalid-hash\"}";
Assert.ThrowsAny<Exception>(() =>
{
var snapshot = JsonSerializer.Deserialize<PacaVaultSnapshot>(invalidJson);
if (snapshot == null || !snapshot.VerifyChecksum())
{
throw new InvalidDataException("Checksum verification failed");
}
});
}
[Fact]
public void Gate173_VaultRestorer_Merge_Strategy()
{
var currentFavorites = new List<string> { "https://youtu.be/1", "https://youtu.be/2" };
var backupFavorites = new List<string> { "https://youtu.be/2", "https://youtu.be/3" };
var merged = VaultRestorer.MergeLists(currentFavorites, backupFavorites);
// 중복 제거되어 1, 2, 3 총 3개 존재 확인
Assert.Equal(3, merged.Count);
Assert.Contains("https://youtu.be/1", merged);
Assert.Contains("https://youtu.be/2", merged);
Assert.Contains("https://youtu.be/3", merged);
}
[Fact]
public void Gate174_ServerHost_VaultEndpoints_Registered()
{
var serverHostPath = Path.Combine(SourceTree.Root, "src", "Paca.Server", "ServerHost.cs");
Assert.True(File.Exists(serverHostPath), "ServerHost.cs must exist");
var code = File.ReadAllText(serverHostPath);
Assert.Contains("/api/vault/backup", code);
Assert.Contains("/api/vault/restore", code);
}
}