first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,421 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
const API_RESPONSE = {
|
||||
object: 'list',
|
||||
results: [
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-8162-bd53-fc201157675f',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'paragraph',
|
||||
paragraph: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'new text',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'new text',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-8104-8d3f-c8ca8919e791',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'heading_1',
|
||||
heading_1: {
|
||||
is_toggleable: false,
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'h1',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'h1',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-814d-b4ad-f65a2c558bb9',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'heading_2',
|
||||
heading_2: {
|
||||
is_toggleable: false,
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'h2',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'h2',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-8135-9e43-f3f8a21e2e86',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'heading_3',
|
||||
heading_3: {
|
||||
is_toggleable: false,
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'h3',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'h3',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-816b-9457-efba183a957c',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'toggle',
|
||||
toggle: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'toggle',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'toggle',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-814f-9928-ed87ed0d9470',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'to_do',
|
||||
to_do: {
|
||||
checked: false,
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'todo',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'todo',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-812d-95e9-dc8ddc3153dd',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'bulleted_list_item',
|
||||
bulleted_list_item: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'bullet 1',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'bullet 1',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-8106-9a25-d3859984ce34',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'numbered_list_item',
|
||||
numbered_list_item: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'point 1',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'point 1',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-81b1-a6f1-eac377c4d163',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:40:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'paragraph',
|
||||
paragraph: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: '',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: '',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
next_cursor: null,
|
||||
has_more: false,
|
||||
request_id: '33358f1b-fc4d-4387-8d95-43c7d03519a5',
|
||||
};
|
||||
|
||||
describe('Test NotionV2, block => append', () => {
|
||||
nock('https://api.notion.com')
|
||||
.patch('/v1/blocks/90e03468f8aa457695da02ccad963040/children')
|
||||
.reply(200, API_RESPONSE);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['append.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,535 @@
|
||||
{
|
||||
"name": "tests notion",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "4260fdbd-e92f-4712-8114-38b85f8289ea",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "block",
|
||||
"blockId": {
|
||||
"__rl": true,
|
||||
"value": "https://www.notion.so/Block-Test-88188cbb303e4f44847f27d24bd7ad8e?pvs=4#90e03468f8aa457695da02ccad963040",
|
||||
"mode": "url"
|
||||
},
|
||||
"blockUi": {
|
||||
"blockValues": [
|
||||
{
|
||||
"richText": true,
|
||||
"text": {
|
||||
"text": [
|
||||
{
|
||||
"text": "new text",
|
||||
"annotationUi": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "heading_1",
|
||||
"textContent": "h1"
|
||||
},
|
||||
{
|
||||
"type": "heading_2",
|
||||
"textContent": "h2"
|
||||
},
|
||||
{
|
||||
"type": "heading_3",
|
||||
"textContent": "h3"
|
||||
},
|
||||
{
|
||||
"type": "toggle",
|
||||
"textContent": "toggle"
|
||||
},
|
||||
{
|
||||
"type": "to_do",
|
||||
"textContent": "todo"
|
||||
},
|
||||
{
|
||||
"type": "bulleted_list_item",
|
||||
"textContent": "bullet 1"
|
||||
},
|
||||
{
|
||||
"type": "numbered_list_item",
|
||||
"textContent": "point 1"
|
||||
},
|
||||
{}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "5ab80e6a-c9c4-4cc5-9332-2fc7a3f8ae24",
|
||||
"name": "Notion",
|
||||
"type": "n8n-nodes-base.notion",
|
||||
"typeVersion": 2.2,
|
||||
"position": [1040, 360],
|
||||
"credentials": {
|
||||
"notionApi": {
|
||||
"id": "CiZXWkDmjiZzpcL1",
|
||||
"name": "Notion account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "a664f506-72a5-4e50-80b4-97ed2e6eb334",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1260, 360]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"object": "list",
|
||||
"results": [
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-8162-bd53-fc201157675f",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "paragraph",
|
||||
"paragraph": {
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "new text",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "new text",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-8104-8d3f-c8ca8919e791",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "heading_1",
|
||||
"heading_1": {
|
||||
"is_toggleable": false,
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "h1",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "h1",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-814d-b4ad-f65a2c558bb9",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "heading_2",
|
||||
"heading_2": {
|
||||
"is_toggleable": false,
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "h2",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "h2",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-8135-9e43-f3f8a21e2e86",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "heading_3",
|
||||
"heading_3": {
|
||||
"is_toggleable": false,
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "h3",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "h3",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-816b-9457-efba183a957c",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "toggle",
|
||||
"toggle": {
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "toggle",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "toggle",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-814f-9928-ed87ed0d9470",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "to_do",
|
||||
"to_do": {
|
||||
"checked": false,
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "todo",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "todo",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-812d-95e9-dc8ddc3153dd",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "bulleted_list_item",
|
||||
"bulleted_list_item": {
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "bullet 1",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "bullet 1",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-8106-9a25-d3859984ce34",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "numbered_list_item",
|
||||
"numbered_list_item": {
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "point 1",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "point 1",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"object": "block",
|
||||
"id": "15bfb9cb-4cf0-81b1-a6f1-eac377c4d163",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"created_time": "2024-12-13T03:40:00.000Z",
|
||||
"last_edited_time": "2024-12-13T03:40:00.000Z",
|
||||
"created_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "paragraph",
|
||||
"paragraph": {
|
||||
"color": "default",
|
||||
"text": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"content": "",
|
||||
"link": null
|
||||
},
|
||||
"annotations": {
|
||||
"bold": false,
|
||||
"italic": false,
|
||||
"strikethrough": false,
|
||||
"underline": false,
|
||||
"code": false,
|
||||
"color": "default"
|
||||
},
|
||||
"plain_text": "",
|
||||
"href": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"next_cursor": null,
|
||||
"has_more": false,
|
||||
"request_id": "33358f1b-fc4d-4387-8d95-43c7d03519a5"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Notion",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Notion": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "87575721-cf21-472f-a9f0-24aa31c8100f",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
|
||||
},
|
||||
"id": "Ucav6QC99JNMCkd3",
|
||||
"tags": []
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
import { NodeTestHarness } from '@nodes-testing/node-test-harness';
|
||||
import nock from 'nock';
|
||||
|
||||
const API_RESPONSE = {
|
||||
results: [
|
||||
{
|
||||
object: 'block',
|
||||
id: 'b14bdaaf-b7e9-48c9-a7fa-1b9e1e2092ae',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2023-11-23T10:42:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:35:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
has_children: true,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'toggle',
|
||||
toggle: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'Drop down First',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'Drop down First',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: 'de572f5d-ff5c-4c13-a879-efc20fe47db0',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2023-11-23T10:42:00.000Z',
|
||||
last_edited_time: '2024-03-11T12:39:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
has_children: true,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'bulleted_list_item',
|
||||
bulleted_list_item: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'Bullet Point Second',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'Bullet Point Second',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: 'c98cf981-c967-47f5-9948-4aa1be9ce9d0',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2023-11-24T04:41:00.000Z',
|
||||
last_edited_time: '2024-12-13T03:35:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'heading_2',
|
||||
heading_2: {
|
||||
is_toggleable: false,
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: 'Hello World',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: 'Hello World',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '527a0555-a486-401e-93a8-19819615c132',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2023-11-23T10:42:00.000Z',
|
||||
last_edited_time: '2023-11-23T10:43:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'child_page',
|
||||
child_page: {
|
||||
title: 'Page Third',
|
||||
},
|
||||
},
|
||||
{
|
||||
object: 'block',
|
||||
id: '15bfb9cb-4cf0-81b1-a6f1-eac377c4d163',
|
||||
parent: {
|
||||
type: 'block_id',
|
||||
block_id: '90e03468-f8aa-4576-95da-02ccad963040',
|
||||
},
|
||||
created_time: '2024-12-13T03:40:00.000Z',
|
||||
last_edited_time: '2024-12-13T06:15:00.000Z',
|
||||
created_by: {
|
||||
object: 'user',
|
||||
id: 'f215e49c-4677-40c0-9adc-87440d341324',
|
||||
},
|
||||
last_edited_by: {
|
||||
object: 'user',
|
||||
id: '88f72c1a-07ed-4bae-9fa0-231365d813d9',
|
||||
},
|
||||
has_children: false,
|
||||
archived: false,
|
||||
in_trash: false,
|
||||
type: 'paragraph',
|
||||
paragraph: {
|
||||
color: 'default',
|
||||
text: [
|
||||
{
|
||||
type: 'text',
|
||||
text: {
|
||||
content: '',
|
||||
link: null,
|
||||
},
|
||||
annotations: {
|
||||
bold: false,
|
||||
italic: false,
|
||||
strikethrough: false,
|
||||
underline: false,
|
||||
code: false,
|
||||
color: 'default',
|
||||
},
|
||||
plain_text: '',
|
||||
href: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
has_more: false,
|
||||
};
|
||||
|
||||
describe('Test NotionV2, block => getAll', () => {
|
||||
nock('https://api.notion.com')
|
||||
.get('/v1/blocks/90e03468f8aa457695da02ccad963040/children')
|
||||
.reply(200, API_RESPONSE);
|
||||
|
||||
new NodeTestHarness().setupTests({
|
||||
workflowFiles: ['getAll.workflow.json'],
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,188 @@
|
||||
{
|
||||
"name": "tests notion",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "4260fdbd-e92f-4712-8114-38b85f8289ea",
|
||||
"name": "When clicking ‘Execute workflow’",
|
||||
"type": "n8n-nodes-base.manualTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [820, 360]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "block",
|
||||
"operation": "getAll",
|
||||
"blockId": {
|
||||
"__rl": true,
|
||||
"value": "https://www.notion.so/Block-Test-88188cbb303e4f44847f27d24bd7ad8e?pvs=4#90e03468f8aa457695da02ccad963040",
|
||||
"mode": "url"
|
||||
},
|
||||
"returnAll": true
|
||||
},
|
||||
"id": "5ab80e6a-c9c4-4cc5-9332-2fc7a3f8ae24",
|
||||
"name": "Notion",
|
||||
"type": "n8n-nodes-base.notion",
|
||||
"typeVersion": 2.2,
|
||||
"position": [1040, 360],
|
||||
"credentials": {
|
||||
"notionApi": {
|
||||
"id": "CiZXWkDmjiZzpcL1",
|
||||
"name": "Notion account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "a664f506-72a5-4e50-80b4-97ed2e6eb334",
|
||||
"name": "No Operation, do nothing",
|
||||
"type": "n8n-nodes-base.noOp",
|
||||
"typeVersion": 1,
|
||||
"position": [1260, 360]
|
||||
}
|
||||
],
|
||||
"pinData": {
|
||||
"No Operation, do nothing": [
|
||||
{
|
||||
"json": {
|
||||
"object": "block",
|
||||
"parent_id": "90e03468f8aa457695da02ccad963040",
|
||||
"id": "b14bdaaf-b7e9-48c9-a7fa-1b9e1e2092ae",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "88f72c1a-07ed-4bae-9fa0-231365d813d9"
|
||||
},
|
||||
"has_children": true,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "toggle",
|
||||
"root_id": "90e03468f8aa457695da02ccad963040",
|
||||
"content": "Drop down First"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"object": "block",
|
||||
"parent_id": "90e03468f8aa457695da02ccad963040",
|
||||
"id": "de572f5d-ff5c-4c13-a879-efc20fe47db0",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "f215e49c-4677-40c0-9adc-87440d341324"
|
||||
},
|
||||
"has_children": true,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "bulleted_list_item",
|
||||
"root_id": "90e03468f8aa457695da02ccad963040",
|
||||
"content": "Bullet Point Second"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"object": "block",
|
||||
"parent_id": "90e03468f8aa457695da02ccad963040",
|
||||
"id": "c98cf981-c967-47f5-9948-4aa1be9ce9d0",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "88f72c1a-07ed-4bae-9fa0-231365d813d9"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "heading_2",
|
||||
"root_id": "90e03468f8aa457695da02ccad963040",
|
||||
"content": "Hello World"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"object": "block",
|
||||
"parent_id": "90e03468f8aa457695da02ccad963040",
|
||||
"id": "527a0555-a486-401e-93a8-19819615c132",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "88f72c1a-07ed-4bae-9fa0-231365d813d9"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "child_page",
|
||||
"root_id": "90e03468f8aa457695da02ccad963040",
|
||||
"content": "Page Third"
|
||||
}
|
||||
},
|
||||
{
|
||||
"json": {
|
||||
"object": "block",
|
||||
"parent_id": "90e03468f8aa457695da02ccad963040",
|
||||
"id": "15bfb9cb-4cf0-81b1-a6f1-eac377c4d163",
|
||||
"parent": {
|
||||
"type": "block_id",
|
||||
"block_id": "90e03468-f8aa-4576-95da-02ccad963040"
|
||||
},
|
||||
"last_edited_by": {
|
||||
"object": "user",
|
||||
"id": "88f72c1a-07ed-4bae-9fa0-231365d813d9"
|
||||
},
|
||||
"has_children": false,
|
||||
"archived": false,
|
||||
"in_trash": false,
|
||||
"type": "paragraph",
|
||||
"root_id": "90e03468f8aa457695da02ccad963040",
|
||||
"content": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"connections": {
|
||||
"When clicking ‘Execute workflow’": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Notion",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Notion": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "No Operation, do nothing",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "3edb0c05-7e84-4953-a6a5-86c3c6824403",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "be251a83c052a9862eeac953816fbb1464f89dfbf79d7ac490a8e336a8cc8bfd"
|
||||
},
|
||||
"id": "Ucav6QC99JNMCkd3",
|
||||
"tags": []
|
||||
}
|
||||
Reference in New Issue
Block a user