Show plain German strategy names with explanations in the dashboard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e250a120ea
commit
0655af2699
11 files changed
+234
-12
No files matched your search
@@ -76,6 +76,15 @@ public sealed class RecentCatchesTests : IDisposable
|
||||
recent.Total.ShouldBe(expected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Search_also_matches_strategy_base_names_from_display_names()
|
||||
{
|
||||
var recent = await _queries.GetRecentAsync(new RecentFilter(Search: "Zugangsdaten", SearchStrategies: ["env-drip"]));
|
||||
|
||||
recent.Total.ShouldBe(2);
|
||||
recent.Items.ShouldAllBe(e => e.Strategy == "env-drip");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Returns_an_empty_result_when_nothing_matches()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using Flypaper.Core.Strategies;
|
||||
using Flypaper.Web.Components.Shared;
|
||||
using Shouldly;
|
||||
|
||||
namespace Flypaper.Tests.Web;
|
||||
|
||||
public sealed class StrategyNamesTests
|
||||
{
|
||||
[Fact]
|
||||
public void Describes_the_maze_with_all_suffixes()
|
||||
{
|
||||
var info = StrategyNames.Describe("maze-drip 50-500ms 1-1024B head 1024B link 160B repeat");
|
||||
|
||||
info.DisplayName.ShouldBe("Link-Labyrinth");
|
||||
info.Explanation.ShouldNotBeNull();
|
||||
info.Details.ShouldBe([
|
||||
"tröpfelt 1–1.024 Byte alle 50–500 ms",
|
||||
"schneller Start: die ersten 1.024 Byte sofort",
|
||||
"alle 160 Byte ein Link",
|
||||
"Wiederholer: darf länger festgehalten werden"
|
||||
]);
|
||||
info.Raw.ShouldBe("maze-drip 50-500ms 1-1024B head 1024B link 160B repeat");
|
||||
info.Tooltip.ShouldContain("Technisch: maze-drip 50-500ms");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Shows_unknown_names_and_tokens_unchanged()
|
||||
{
|
||||
var info = StrategyNames.Describe("ufo-drip 5-9ms 1-2B odd");
|
||||
|
||||
info.DisplayName.ShouldBe("ufo-drip");
|
||||
info.Explanation.ShouldBeNull();
|
||||
info.Details.ShouldBe(["tröpfelt 1–2 Byte alle 5–9 ms", "odd"]);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("robots-static")]
|
||||
[InlineData("robots-bait 10-20ms 1-8B link 160B")]
|
||||
public void Covers_robots_strategies(string strategy) =>
|
||||
StrategyNames.Describe(strategy).Explanation.ShouldNotBeNull();
|
||||
|
||||
[Fact]
|
||||
public void Covers_every_strategy_name_of_the_core()
|
||||
{
|
||||
string[] names =
|
||||
[
|
||||
MazeDripStrategy.PageName, MazeDripStrategy.ListingName, MazeDripStrategy.BaitName,
|
||||
HtmlDripStrategy.StrategyName, TextDripStrategy.StrategyName, RobotsStaticStrategy.StrategyName,
|
||||
.. FileContent.Profiles.Select(profile => profile.Name)
|
||||
];
|
||||
|
||||
foreach (var name in names)
|
||||
{
|
||||
StrategyNames.Describe(name).Explanation.ShouldNotBeNull(name);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Finds_base_names_by_display_name()
|
||||
{
|
||||
StrategyNames.Matching(" gefälschtes git ").ShouldBe(["git-drip"]);
|
||||
StrategyNames.Matching("zugangsdaten").ShouldBe(["env-drip"]);
|
||||
StrategyNames.Matching("").ShouldBeEmpty();
|
||||
StrategyNames.Matching("nichts").ShouldBeEmpty();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user