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
76
tests/Paca.Tests/Core/ProxyAutoConfigGateTests.cs
Normal file
76
tests/Paca.Tests/Core/ProxyAutoConfigGateTests.cs
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Paca.Mobile.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Core;
|
||||
|
||||
public class ProxyAutoConfigGateTests
|
||||
{
|
||||
[Fact]
|
||||
public void Gate397_ProxyAutoConfig_GeneratesStandardJavaScriptPac()
|
||||
{
|
||||
var config = new PacConfig
|
||||
{
|
||||
DefaultAction = "DIRECT",
|
||||
Rules = new List<PacRoutingRule>
|
||||
{
|
||||
new("*.youtube.com", "PROXY 127.0.0.1:1080; DIRECT"),
|
||||
new("*.googlevideo.com", "PROXY 127.0.0.1:1080; DIRECT")
|
||||
}
|
||||
};
|
||||
|
||||
var pacScript = ProxyAutoConfigEngine.GeneratePacScript(config);
|
||||
|
||||
Assert.Contains("function FindProxyForURL(url, host)", pacScript);
|
||||
Assert.Contains("shExpMatch(host, \"*.youtube.com\")", pacScript);
|
||||
Assert.Contains("return \"PROXY 127.0.0.1:1080; DIRECT\";", pacScript);
|
||||
Assert.Contains("return \"DIRECT\";", pacScript);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate398_ProxyAutoConfig_EvaluatesHostRoute_ForMatchingDomain()
|
||||
{
|
||||
var config = new PacConfig
|
||||
{
|
||||
DefaultAction = "DIRECT",
|
||||
Rules = new List<PacRoutingRule>
|
||||
{
|
||||
new("*.instagram.com", "PROXY proxy.corp:8080"),
|
||||
new("*.tiktok.com", "SOCKS5 127.0.0.1:9050")
|
||||
}
|
||||
};
|
||||
|
||||
var routeInstagram = ProxyAutoConfigEngine.EvaluateHostRoute(config, "www.instagram.com");
|
||||
Assert.Equal("PROXY proxy.corp:8080", routeInstagram);
|
||||
|
||||
var routeTiktok = ProxyAutoConfigEngine.EvaluateHostRoute(config, "v16.tiktok.com");
|
||||
Assert.Equal("SOCKS5 127.0.0.1:9050", routeTiktok);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate399_ProxyAutoConfig_FallsBackToDirect_ForUnmatchedDomain()
|
||||
{
|
||||
var config = new PacConfig
|
||||
{
|
||||
DefaultAction = "DIRECT",
|
||||
Rules = new List<PacRoutingRule>
|
||||
{
|
||||
new("*.twitter.com", "PROXY 127.0.0.1:8080")
|
||||
}
|
||||
};
|
||||
|
||||
var route = ProxyAutoConfigEngine.EvaluateHostRoute(config, "github.com");
|
||||
Assert.Equal("DIRECT", route);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Gate400_ProxyAutoConfig_HandlesEmptyRulesGracefully()
|
||||
{
|
||||
var emptyConfig = new PacConfig { DefaultAction = "DIRECT" };
|
||||
var script = ProxyAutoConfigEngine.GeneratePacScript(emptyConfig);
|
||||
|
||||
Assert.Contains("return \"DIRECT\";", script);
|
||||
Assert.Equal("DIRECT", ProxyAutoConfigEngine.EvaluateHostRoute(emptyConfig, "example.com"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue