Skip to content

Commit 85a73d7

Browse files
Add integration test for Template block ✅
1 parent 5969201 commit 85a73d7

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Test/Notion.IntegrationTests/IBlocksClientTests.cs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,60 @@ private static IEnumerable<object[]> BlockData()
452452

453453
Assert.Equal("https://www.iaspaper.net/wp-content/uploads/2017/09/TNEA-Online-Application.jpg", embedBlock.Embed.Url);
454454
})
455+
},
456+
new object[]
457+
{
458+
new TemplateBlock()
459+
{
460+
Template = new TemplateBlock.Data
461+
{
462+
Text = new List<RichTextBase>
463+
{
464+
new RichTextText
465+
{
466+
Text = new Text
467+
{
468+
Content = "Test Template"
469+
}
470+
}
471+
},
472+
Children = new List<ITemplateChildrendBlock>
473+
{
474+
new EmbedBlock()
475+
{
476+
Embed = new EmbedBlock.Info
477+
{
478+
Url = "https://zephoria.com/wp-content/uploads/2014/08/online-community.jpg"
479+
}
480+
}
481+
}
482+
}
483+
},
484+
new TemplateUpdateBlock()
485+
{
486+
Template = new TemplateUpdateBlock.Data
487+
{
488+
Text = new List<RichTextBaseInput>
489+
{
490+
new RichTextTextInput
491+
{
492+
Text = new Text
493+
{
494+
Content = "Test Template 2"
495+
}
496+
}
497+
}
498+
}
499+
},
500+
new Action<IBlock> (block =>
501+
{
502+
Assert.NotNull(block);
503+
var templateBlock = Assert.IsType<TemplateBlock>(block);
504+
505+
Assert.Single(templateBlock.Template.Text);
506+
Assert.Null(templateBlock.Template.Children);
507+
Assert.Equal("Test Template 2", templateBlock.Template.Text.OfType<RichTextText>().First().Text.Content);
508+
})
455509
}
456510
};
457511
}

0 commit comments

Comments
 (0)