11import { getBlocksFromHTML } from "@/core/import-html/html-to-json" ;
2- import { syncBlocksWithDefaults } from "@/runtime" ;
2+ import { syncBlocksWithDefaultProps } from "@/runtime" ;
33import { describe , expect , it , vi } from "vitest" ;
44
55// Mock the runtime module
66vi . mock ( "@/runtime" , ( ) => ( {
7- syncBlocksWithDefaults : vi . fn ( ( blocks ) => blocks ) ,
7+ syncBlocksWithDefaultProps : vi . fn ( ( blocks ) => blocks ) ,
88} ) ) ;
99
10- describe ( "ImportHTML - syncBlocksWithDefaults integration" , ( ) => {
11- it ( "should call syncBlocksWithDefaults when importing HTML with empty heading" , ( ) => {
10+ describe ( "ImportHTML - syncBlocksWithDefaultProps integration" , ( ) => {
11+ it ( "should call syncBlocksWithDefaultProps when importing HTML with empty heading" , ( ) => {
1212 // HTML snippet with an empty heading (common scenario that causes the crash)
1313 const html = '<h1 class="text-2xl"></h1>' ;
1414
1515 const blocks = getBlocksFromHTML ( html ) ;
16- const syncedBlocks = syncBlocksWithDefaults ( blocks ) ;
16+ const syncedBlocks = syncBlocksWithDefaultProps ( blocks ) ;
1717
18- // Verify that syncBlocksWithDefaults was called
19- expect ( vi . mocked ( syncBlocksWithDefaults ) ) . toHaveBeenCalledWith ( blocks ) ;
18+ // Verify that syncBlocksWithDefaultProps was called
19+ expect ( vi . mocked ( syncBlocksWithDefaultProps ) ) . toHaveBeenCalledWith ( blocks ) ;
2020 expect ( syncedBlocks ) . toBeDefined ( ) ;
2121 } ) ;
2222
23- it ( "should call syncBlocksWithDefaults when importing HTML with multiple blocks" , ( ) => {
23+ it ( "should call syncBlocksWithDefaultProps when importing HTML with multiple blocks" , ( ) => {
2424 const html = `
2525 <div class="container">
2626 <h1></h1>
@@ -30,19 +30,19 @@ describe("ImportHTML - syncBlocksWithDefaults integration", () => {
3030 ` ;
3131
3232 const blocks = getBlocksFromHTML ( html ) ;
33- const syncedBlocks = syncBlocksWithDefaults ( blocks ) ;
33+ const syncedBlocks = syncBlocksWithDefaultProps ( blocks ) ;
3434
35- expect ( vi . mocked ( syncBlocksWithDefaults ) ) . toHaveBeenCalled ( ) ;
35+ expect ( vi . mocked ( syncBlocksWithDefaultProps ) ) . toHaveBeenCalled ( ) ;
3636 expect ( syncedBlocks ) . toBeDefined ( ) ;
3737 } ) ;
3838
3939 it ( "should handle paragraphs with empty content" , ( ) => {
4040 const html = '<p class="text-base"></p>' ;
4141
4242 const blocks = getBlocksFromHTML ( html ) ;
43- const syncedBlocks = syncBlocksWithDefaults ( blocks ) ;
43+ const syncedBlocks = syncBlocksWithDefaultProps ( blocks ) ;
4444
45- expect ( vi . mocked ( syncBlocksWithDefaults ) ) . toHaveBeenCalledWith ( blocks ) ;
45+ expect ( vi . mocked ( syncBlocksWithDefaultProps ) ) . toHaveBeenCalledWith ( blocks ) ;
4646 expect ( syncedBlocks ) . toBeDefined ( ) ;
4747 } ) ;
4848
@@ -65,9 +65,9 @@ describe("ImportHTML - syncBlocksWithDefaults integration", () => {
6565 ` ;
6666
6767 const blocks = getBlocksFromHTML ( html ) ;
68- const syncedBlocks = syncBlocksWithDefaults ( blocks ) ;
68+ const syncedBlocks = syncBlocksWithDefaultProps ( blocks ) ;
6969
70- expect ( vi . mocked ( syncBlocksWithDefaults ) ) . toHaveBeenCalled ( ) ;
70+ expect ( vi . mocked ( syncBlocksWithDefaultProps ) ) . toHaveBeenCalled ( ) ;
7171 expect ( syncedBlocks ) . toBeDefined ( ) ;
7272 } ) ;
7373} ) ;
0 commit comments