Skip to content

Commit

Permalink
add unit test and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
softlion committed Jan 11, 2024
1 parent 224d802 commit 59b388e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions NotionSharp.ApiClient.Tests/TestNotionBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,14 @@ public async Task TestPageAndChildrenDeserialization()
Assert.IsNotNull(blocks);
}

[TestMethod]
public void TestNotionUtils()
{
var baseUri = new Uri("https://vapolia.notion.site");
var title = "Creating a good Xamarin Forms Control Part 2 UI Day 3";
var pageId = "a1744f66-81bf-41a5-b93d-70cbdf6bc3db";
var url = NotionUtils.GetPageUri(pageId, title, baseUri).ToString();
Assert.AreEqual("https://vapolia.notion.site/Creating-a-good-Xamarin-Forms-Control-Part-2-UI-Day-3-a1744f6681bf41a5b93d70cbdf6bc3db", url);
}

}
2 changes: 1 addition & 1 deletion NotionSharp.ApiClient/Lib/Helpers/NotionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class NotionUtils
public static Uri GetPageUri(string pageId, string? title, Uri baseUrl)
{
var pageTitle = Uri.EscapeDataString(TrimSpaces.Replace(title ?? "", "-"));
pageId = pageId.Trim('-');
pageId = pageId.Replace("-", string.Empty);
return new(baseUrl, $"{pageTitle}-{pageId}");
}

Expand Down
2 changes: 1 addition & 1 deletion NotionSharp.ApiClient/NotionSharp.ApiClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PropertyGroup>
<!-- nuget configurable properties -->
<Version>2.0.0</Version>
<VersionSuffix>-pre4</VersionSuffix>
<VersionSuffix>-pre5</VersionSuffix>
<DefineConstants>$(DefineConstants);</DefineConstants>
</PropertyGroup>

Expand Down

0 comments on commit 59b388e

Please sign in to comment.