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
129
tests/Paca.Tests/Browser/ChromeHistoryEngineTests.cs
Normal file
129
tests/Paca.Tests/Browser/ChromeHistoryEngineTests.cs
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Paca.Browser.History;
|
||||
using Xunit;
|
||||
|
||||
namespace Paca.Tests.Browser;
|
||||
|
||||
public class ChromeHistoryEngineTests
|
||||
{
|
||||
[Fact]
|
||||
public void HistoryFilter_Filters_By_Keywords_And_Domain()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var entries = new List<ChromeHistoryEntry>
|
||||
{
|
||||
new("https://github.com/microsoft/vscode", "Microsoft VS Code Repository", now.AddMinutes(-10)),
|
||||
new("https://github.com/dotnet/runtime", "dotnet/runtime on GitHub", now.AddHours(-1)),
|
||||
new("https://developer.mozilla.org/en-US/", "MDN Web Docs", now.AddHours(-2)),
|
||||
new("https://news.ycombinator.com/", "Hacker News", now.AddDays(-1))
|
||||
};
|
||||
|
||||
var engine = new ChromeHistoryEngine(entries);
|
||||
|
||||
// Keyword search in title or url
|
||||
var searchGit = engine.Search("GitHub");
|
||||
Assert.Equal(2, searchGit.Count);
|
||||
|
||||
var searchMdn = engine.Search("docs");
|
||||
Assert.Single(searchMdn);
|
||||
Assert.Equal("MDN Web Docs", searchMdn[0].Title);
|
||||
|
||||
// Domain search
|
||||
var domainHits = engine.GetByDomain("github.com");
|
||||
Assert.Equal(2, domainHits.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HistoryClustering_Groups_Into_Today_Yesterday_Last7Days_And_Older()
|
||||
{
|
||||
var now = new DateTime(2026, 9, 13, 12, 0, 0, DateTimeKind.Utc);
|
||||
var entries = new List<ChromeHistoryEntry>
|
||||
{
|
||||
new("https://site1.com", "Site 1", now.AddMinutes(-5)), // Today
|
||||
new("https://site2.com", "Site 2", now.AddDays(-1).AddHours(-1)), // Yesterday
|
||||
new("https://site3.com", "Site 3", now.AddDays(-3)), // Last 7 Days
|
||||
new("https://site4.com", "Site 4", now.AddDays(-10)) // Older
|
||||
};
|
||||
|
||||
var engine = new ChromeHistoryEngine(entries);
|
||||
var clustered = engine.GetClusteredHistory(now);
|
||||
|
||||
Assert.Single(clustered.Today);
|
||||
Assert.Equal("Site 1", clustered.Today[0].Title);
|
||||
|
||||
Assert.Single(clustered.Yesterday);
|
||||
Assert.Equal("Site 2", clustered.Yesterday[0].Title);
|
||||
|
||||
Assert.Single(clustered.Last7Days);
|
||||
Assert.Equal("Site 3", clustered.Last7Days[0].Title);
|
||||
|
||||
Assert.Single(clustered.Older);
|
||||
Assert.Equal("Site 4", clustered.Older[0].Title);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HistoryAggregator_Groups_By_Domain_With_Visit_Counts()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var entries = new List<ChromeHistoryEntry>
|
||||
{
|
||||
new("https://github.com/microsoft/vscode", "VS Code", now.AddMinutes(-10)),
|
||||
new("https://github.com/dotnet/runtime", "Dotnet", now.AddMinutes(-5)),
|
||||
new("https://github.com/golang/go", "Golang", now),
|
||||
new("https://google.com/search?q=test", "Google Search", now.AddHours(-1))
|
||||
};
|
||||
|
||||
var engine = new ChromeHistoryEngine(entries);
|
||||
var domainSummaries = engine.GetDomainSummaries();
|
||||
|
||||
Assert.Equal(2, domainSummaries.Count);
|
||||
|
||||
var githubSummary = domainSummaries.First(s => s.Domain == "github.com");
|
||||
Assert.Equal(3, githubSummary.TotalVisits);
|
||||
Assert.Equal(3, githubSummary.Entries.Count);
|
||||
|
||||
var googleSummary = domainSummaries.First(s => s.Domain == "google.com");
|
||||
Assert.Equal(1, googleSummary.TotalVisits);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HistoryDeletion_Removes_By_Domain_Or_Date_Range()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
var entries = new List<ChromeHistoryEntry>
|
||||
{
|
||||
new("https://github.com/1", "GH1", now.AddMinutes(-10)),
|
||||
new("https://github.com/2", "GH2", now.AddHours(-5)),
|
||||
new("https://google.com/1", "G1", now.AddDays(-2)),
|
||||
new("https://spam.com/bad", "Spam", now.AddDays(-15))
|
||||
};
|
||||
|
||||
var engine = new ChromeHistoryEngine(entries);
|
||||
|
||||
// Delete by domain
|
||||
int deletedGithub = engine.DeleteByDomain("github.com");
|
||||
Assert.Equal(2, deletedGithub);
|
||||
Assert.Equal(2, engine.AllEntries.Count);
|
||||
Assert.DoesNotContain(engine.AllEntries, e => e.Url.Contains("github.com"));
|
||||
|
||||
// Clear older than 10 days
|
||||
int deletedOld = engine.ClearOlderThan(TimeSpan.FromDays(10), now);
|
||||
Assert.Equal(1, deletedOld);
|
||||
Assert.Single(engine.AllEntries);
|
||||
Assert.Equal("https://google.com/1", engine.AllEntries[0].Url);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("방문 기록")]
|
||||
[InlineData("히스토리")]
|
||||
[InlineData("history")]
|
||||
[InlineData("search history")]
|
||||
public void Omnibox_Matches_History_Action(string query)
|
||||
{
|
||||
var actions = Paca.Browser.Tabs.OmniboxActionEvaluator.GetMatchingActions(query);
|
||||
Assert.NotEmpty(actions);
|
||||
Assert.Contains(actions, a => a.ActionId == "action:history");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue