Skip to content

Commit 2039a3e

Browse files
Add support to update embed block ✨
* Added integration tests
1 parent 4089a9c commit 2039a3e

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class EmbedUpdateBlock : UpdateBlock, IUpdateBlock
6+
{
7+
[JsonProperty("embed")]
8+
public Data Embed { get; set; }
9+
10+
public class Data
11+
{
12+
[JsonProperty("url")]
13+
public string Url { get; set; }
14+
}
15+
}
16+
}

Test/Notion.IntegrationTests/IBlocksClientTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,30 @@ private static IEnumerable<object[]> BlockData()
428428

429429
Assert.Equal("https://www.iaspaper.net/wp-content/uploads/2017/09/TNEA-Online-Application.jpg", imageFile.External.Url);
430430
})
431+
},
432+
new object[]
433+
{
434+
new EmbedBlock()
435+
{
436+
Embed = new EmbedBlock.Info
437+
{
438+
Url = "https://zephoria.com/wp-content/uploads/2014/08/online-community.jpg"
439+
}
440+
},
441+
new EmbedUpdateBlock()
442+
{
443+
Embed = new EmbedUpdateBlock.Data
444+
{
445+
Url = "https://www.iaspaper.net/wp-content/uploads/2017/09/TNEA-Online-Application.jpg"
446+
}
447+
},
448+
new Action<IBlock> (block =>
449+
{
450+
Assert.NotNull(block);
451+
var embedBlock = Assert.IsType<EmbedBlock>(block);
452+
453+
Assert.Equal("https://www.iaspaper.net/wp-content/uploads/2017/09/TNEA-Online-Application.jpg", embedBlock.Embed.Url);
454+
})
431455
}
432456
};
433457
}

0 commit comments

Comments
 (0)