Skip to content

Commit f2901a8

Browse files
Merge pull request #306 from notion-dotnet/258-fix-breaking-integration-tests
Fix breaking integration tests
2 parents d335c71 + f044e58 commit f2901a8

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

Test/Notion.IntegrationTests/IPageClientTests.cs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,15 @@ public async Task CreateAsync_CreatesANewPage()
5353
.DatabaseId.Should().Be(_databaseId);
5454

5555
page.Properties.Should().ContainKey("Name");
56-
page.Properties["Name"].Should().BeOfType<TitlePropertyValue>().Which
57-
.Title.First().PlainText.Should().Be("Test Page Title");
56+
var pageProperty = page.Properties["Name"].Should().BeOfType<PagePropertyOnId>().Subject;
57+
58+
var titleProperty = (ListPropertyItem)await _client.Pages.RetrievePagePropertyItem(new RetrievePropertyItemParameters
59+
{
60+
PageId = page.Id,
61+
PropertyId = pageProperty.Id
62+
});
63+
64+
titleProperty.Results.First().As<TitlePropertyItem>().Title.PlainText.Should().Be("Test Page Title");
5865

5966
await _client.Pages.UpdateAsync(page.Id, new PagesUpdateParameters
6067
{
@@ -98,8 +105,15 @@ public async Task Bug_unable_to_create_page_with_select_property()
98105
.DatabaseId.Should().Be(_databaseId);
99106

100107
page.Properties.Should().ContainKey("Name");
101-
page.Properties["Name"].Should().BeOfType<TitlePropertyValue>().Which
102-
.Title.First().PlainText.Should().Be("Test Page Title");
108+
var pageProperty = page.Properties["Name"].Should().BeOfType<PagePropertyOnId>().Subject;
109+
110+
var titleProperty = (ListPropertyItem)await _client.Pages.RetrievePagePropertyItem(new RetrievePropertyItemParameters
111+
{
112+
PageId = page.Id,
113+
PropertyId = pageProperty.Id
114+
});
115+
116+
titleProperty.Results.First().As<TitlePropertyItem>().Title.PlainText.Should().Be("Test Page Title");
103117

104118
await _client.Pages.UpdateAsync(page.Id, new PagesUpdateParameters
105119
{

0 commit comments

Comments
 (0)