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:
parent
a88aafa1e5
commit
0e568f1f0a
975 changed files with 130593 additions and 16783 deletions
102
tests/Paca.Tests/Browser/ChromePwaInstallationManagerTests.cs
Normal file
102
tests/Paca.Tests/Browser/ChromePwaInstallationManagerTests.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Paca.Browser.Pwa;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Browser;
|
||||
|
||||
public class ChromePwaInstallationManagerTests
|
||||
{
|
||||
[Fact]
|
||||
public void InstallApp_And_Scope_Matching_Work()
|
||||
{
|
||||
var tempFile = Path.Combine(Path.GetTempPath(), "paca_pwa_test_" + Guid.NewGuid().ToString("N") + ".json");
|
||||
try
|
||||
{
|
||||
var mgr = new WebAppInstallationManager(tempFile);
|
||||
|
||||
var manifest = new WebAppManifest(
|
||||
Name: "Slack Web",
|
||||
ShortName: "Slack",
|
||||
StartUrl: "https://app.slack.com/client/T123/C456",
|
||||
Display: "standalone",
|
||||
ThemeColor: "#4A154B",
|
||||
BackgroundColor: "#1A1D21",
|
||||
Icons: new[] { new WebAppManifestIcon("https://app.slack.com/icon.png", "192x192", "image/png") }
|
||||
);
|
||||
|
||||
var installed = mgr.InstallApp(manifest, scope: "https://app.slack.com/client/");
|
||||
Assert.NotNull(installed);
|
||||
Assert.Equal("Slack Web", installed.Name);
|
||||
Assert.True(mgr.IsAppInstalled(manifest.StartUrl));
|
||||
|
||||
// Matching by URL scope
|
||||
var match1 = mgr.GetAppForUrl("https://app.slack.com/client/T123/C999");
|
||||
Assert.NotNull(match1);
|
||||
Assert.Equal(installed.Id, match1.Id);
|
||||
|
||||
// Outside scope
|
||||
var match2 = mgr.GetAppForUrl("https://app.slack.com/help");
|
||||
Assert.Null(match2);
|
||||
|
||||
// Uninstall
|
||||
Assert.True(mgr.UninstallApp(installed.Id));
|
||||
Assert.False(mgr.IsAppInstalled(manifest.StartUrl));
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tempFile)) File.Delete(tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InstallationManager_Persistence_Works()
|
||||
{
|
||||
var tempFile = Path.Combine(Path.GetTempPath(), "paca_pwa_persist_" + Guid.NewGuid().ToString("N") + ".json");
|
||||
try
|
||||
{
|
||||
var mgr1 = new WebAppInstallationManager(tempFile);
|
||||
var manifest = new WebAppManifest(
|
||||
Name: "Spotify Player",
|
||||
ShortName: "Spotify",
|
||||
StartUrl: "https://open.spotify.com/",
|
||||
Display: "standalone",
|
||||
ThemeColor: "#1DB954",
|
||||
BackgroundColor: "#121212",
|
||||
Icons: new[] { new WebAppManifestIcon("https://open.spotify.com/icon.png", "512x512", "image/png") }
|
||||
);
|
||||
|
||||
mgr1.InstallApp(manifest);
|
||||
|
||||
var mgr2 = new WebAppInstallationManager(tempFile);
|
||||
Assert.Single(mgr2.InstalledApps);
|
||||
Assert.Equal("Spotify Player", mgr2.InstalledApps[0].Name);
|
||||
Assert.Equal("standalone", mgr2.InstalledApps[0].DisplayMode);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tempFile)) File.Delete(tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateShortcutContent_Produces_Valid_Url_File()
|
||||
{
|
||||
var app = new InstalledWebApp(
|
||||
Id: "app_spotify_123",
|
||||
Name: "Spotify Web",
|
||||
StartUrl: "https://open.spotify.com/",
|
||||
Scope: "https://open.spotify.com/",
|
||||
IconUrl: "https://open.spotify.com/icon.png",
|
||||
InstalledAt: DateTime.UtcNow,
|
||||
DisplayMode: "standalone",
|
||||
ThemeColor: "#1DB954"
|
||||
);
|
||||
|
||||
var content = WebAppInstallationManager.GenerateInternetShortcutContent(app);
|
||||
Assert.Contains("[InternetShortcut]", content);
|
||||
Assert.Contains("URL=https://open.spotify.com/", content);
|
||||
Assert.Contains("IconFile=https://open.spotify.com/icon.png", content);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue