1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2025-06-15 00:05:04 +02:00

Add description field to Database struct type (#34)

This commit is contained in:
David Stotijn
2022-08-14 19:40:30 +02:00
committed by GitHub
parent df02b41099
commit b6e74a67d2
2 changed files with 113 additions and 18 deletions

View File

@ -995,6 +995,13 @@ func TestCreateDatabase(t *testing.T) {
},
},
},
Description: []notion.RichText{
{
Text: &notion.Text{
Content: "Lorem ipsum dolor sit amet.",
},
},
},
Properties: notion.DatabaseProperties{
"Title": notion.DatabaseProperty{
Type: notion.DBPropTypeTitle,
@ -1040,6 +1047,25 @@ func TestCreateDatabase(t *testing.T) {
"href": null
}
],
"description": [
{
"type": "text",
"text": {
"content": "Lorem ipsum dolor sit amet.",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Lorem ipsum dolor sit amet.",
"href": null
}
],
"properties": {
"Title": {
"id": "title",
@ -1078,6 +1104,13 @@ func TestCreateDatabase(t *testing.T) {
},
},
},
"description": []interface{}{
map[string]interface{}{
"text": map[string]interface{}{
"content": "Lorem ipsum dolor sit amet.",
},
},
},
"properties": map[string]interface{}{
"Title": map[string]interface{}{
"type": "title",
@ -1117,6 +1150,18 @@ func TestCreateDatabase(t *testing.T) {
PlainText: "Foobar",
},
},
Description: []notion.RichText{
{
Type: notion.RichTextTypeText,
Text: &notion.Text{
Content: "Lorem ipsum dolor sit amet.",
},
Annotations: &notion.Annotations{
Color: notion.ColorDefault,
},
PlainText: "Lorem ipsum dolor sit amet.",
},
},
Properties: notion.DatabaseProperties{
"Title": notion.DatabaseProperty{
ID: "title",
@ -1284,6 +1329,13 @@ func TestUpdateDatabase(t *testing.T) {
},
},
},
Description: []notion.RichText{
{
Text: &notion.Text{
Content: "Updated description.",
},
},
},
Properties: map[string]*notion.DatabaseProperty{
"New": {
Type: notion.DBPropTypeRichText,
@ -1330,6 +1382,25 @@ func TestUpdateDatabase(t *testing.T) {
"href": null
}
],
"description": [
{
"type": "text",
"text": {
"content": "Updated description.",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Updated description.",
"href": null
}
],
"properties": {
"Name": {
"id": "title",
@ -1369,6 +1440,13 @@ func TestUpdateDatabase(t *testing.T) {
},
},
},
"description": []interface{}{
map[string]interface{}{
"text": map[string]interface{}{
"content": "Updated description.",
},
},
},
"properties": map[string]interface{}{
"New": map[string]interface{}{
"type": "rich_text",
@ -1405,6 +1483,18 @@ func TestUpdateDatabase(t *testing.T) {
PlainText: "Grocery List",
},
},
Description: []notion.RichText{
{
Type: notion.RichTextTypeText,
Text: &notion.Text{
Content: "Updated description.",
},
Annotations: &notion.Annotations{
Color: notion.ColorDefault,
},
PlainText: "Updated description.",
},
},
Properties: notion.DatabaseProperties{
"Name": notion.DatabaseProperty{
ID: "title",