fix: correct notification template filter links
Use explicit Razor interpolation for create and edit URLs and cover the rendered link syntax with a regression test. Ref: IT-1039
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
namespace HrynCo.NotificationService.Web.IntegrationTests;
|
||||
|
||||
public sealed class AdminTemplatesIndexViewTests
|
||||
{
|
||||
[Fact]
|
||||
public void CreateAndEditLinks_UseExplicitFilterQueryInterpolation()
|
||||
{
|
||||
string view = File.ReadAllText(FindIndexView());
|
||||
|
||||
Assert.Contains("/admin/templates/create@(filterQuery)", view);
|
||||
Assert.Contains("@t.LanguageCode@(filterQuery)", view);
|
||||
Assert.DoesNotContain("create@filterQuery", view);
|
||||
Assert.DoesNotContain("LanguageCode@filterQuery", view);
|
||||
}
|
||||
|
||||
private static string FindIndexView()
|
||||
{
|
||||
DirectoryInfo? directory = new(AppContext.BaseDirectory);
|
||||
while (directory is not null && !File.Exists(Path.Combine(directory.FullName, "HrynCo.NotificationService.slnx")))
|
||||
{
|
||||
directory = directory.Parent;
|
||||
}
|
||||
|
||||
Assert.NotNull(directory);
|
||||
return Path.Combine(
|
||||
directory.FullName,
|
||||
"HrynCo.NotificationService.Web",
|
||||
"Views",
|
||||
"AdminTemplates",
|
||||
"Index.cshtml");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user