mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(Notion Node): Block with text results in a body validation error (#8622)
This commit is contained in:
@@ -307,7 +307,7 @@ export function formatBlocks(blocks: IDataObject[]) {
|
|||||||
...(block.type === 'to_do' ? { checked: block.checked } : {}),
|
...(block.type === 'to_do' ? { checked: block.checked } : {}),
|
||||||
...(block.type === 'image' ? { type: 'external', external: { url: block.url } } : {}),
|
...(block.type === 'image' ? { type: 'external', external: { url: block.url } } : {}),
|
||||||
// prettier-ignore,
|
// prettier-ignore,
|
||||||
...(!['to_do', 'image'].includes(block.type as string) ? getTextBlocks(block) : {}),
|
...(!['image'].includes(block.type as string) ? getTextBlocks(block) : {}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import { formatBlocks } from '../GenericFunctions';
|
||||||
|
|
||||||
|
describe('Test NotionV2, formatBlocks', () => {
|
||||||
|
it('should format to_do block', () => {
|
||||||
|
const blocks = [
|
||||||
|
{
|
||||||
|
type: 'to_do',
|
||||||
|
checked: false,
|
||||||
|
richText: false,
|
||||||
|
textContent: 'Testing',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const result = formatBlocks(blocks);
|
||||||
|
|
||||||
|
expect(result).toEqual([
|
||||||
|
{
|
||||||
|
object: 'block',
|
||||||
|
type: 'to_do',
|
||||||
|
to_do: {
|
||||||
|
checked: false,
|
||||||
|
text: [
|
||||||
|
{
|
||||||
|
text: {
|
||||||
|
content: 'Testing',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user