Skip to content

Implement some BlocksAPI method #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

gohabereg
Copy link
Member

No description provided.

Copy link

github-actions bot commented Apr 11, 2025

⏭️ No files to mutate for ./packages/model

Copy link

github-actions bot commented Apr 11, 2025

⏭️ No files to mutate for ./packages/dom-adapters

Copy link

Coverage report for ./packages/dom-adapters

St.
Category Percentage Covered / Total
🟢 Statements 100% 0/0
🟢 Branches 100% 0/0
🟢 Functions 100% 0/0
🟢 Lines 100% 0/0

Test suite run success

1 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from 4fa0cd4

Copy link

Coverage report for ./packages/model

Caution

Test run failed

St.
Category Percentage Covered / Total
🟢 Statements
95.37% (-4.38% 🔻)
783/821
🟢 Branches
94.67% (-3.99% 🔻)
213/225
🟢 Functions
90.1% (-8.42% 🔻)
182/202
🟢 Lines
95.32% (-4.43% 🔻)
753/790
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / PropertyModifiedEvent.ts
75% (-25% 🔻)
100%
0% (-100% 🔻)
75% (-25% 🔻)
🟡
... / index.ts
62.24% (-35.69% 🔻)
50% (-40% 🔻)
46.67% (-53.33% 🔻)
62.5% (-35.39% 🔻)

Test suite run failed

Failed tests: 1/359. Failed suites: 2/25.
  ● Test suite failed to run

    src/entities/EditorDocument/EditorDocument.spec.ts:43:18 - error TS2345: Argument of type '{ name: BlockToolName; data: { text: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { text: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    43   doc.initialize(blocks);
                        ~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:74:22 - error TS2345: Argument of type '{ name: BlockToolName; data: { text: { $t: string; value: string; fragments: never[]; }; }; tunes: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { text: { $t: string; value: string; fragments: never[]; }; }; tunes: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    74       doc.initialize(blocks);
                            ~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:99:22 - error TS2345: Argument of type '{ name: BlockToolName; data: { text: { $t: string; value: string; fragments: never[]; }; }; tunes: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { text: { $t: string; value: string; fragments: never[]; }; }; tunes: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    99       doc.initialize(blocks);
                            ~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:103:22 - error TS2345: Argument of type '{ name: BlockToolName; data: { text: { $t: string; value: string; fragments: never[]; }; }; tunes: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { text: { $t: string; value: string; fragments: never[]; }; }; tunes: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    103       doc.initialize(blocks);
                             ~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:324:16 - error TS2551: Property 'moveBlock' does not exist on type 'EditorDocument'. Did you mean 'removeBlock'?

    324       document.moveBlock(0, 1);
                       ~~~~~~~~~

      src/entities/EditorDocument/index.ts:155:10
        155   public removeBlock(index: number): void {
                     ~~~~~~~~~~~
        'removeBlock' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:334:16 - error TS2551: Property 'moveBlock' does not exist on type 'EditorDocument'. Did you mean 'removeBlock'?

    334       document.moveBlock(1, document.length);
                       ~~~~~~~~~

      src/entities/EditorDocument/index.ts:155:10
        155   public removeBlock(index: number): void {
                     ~~~~~~~~~~~
        'removeBlock' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:344:16 - error TS2551: Property 'moveBlock' does not exist on type 'EditorDocument'. Did you mean 'removeBlock'?

    344       document.moveBlock(1, 0);
                       ~~~~~~~~~

      src/entities/EditorDocument/index.ts:155:10
        155   public removeBlock(index: number): void {
                     ~~~~~~~~~~~
        'removeBlock' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:622:27 - error TS2345: Argument of type '{ name: BlockToolName; data: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    622       document.initialize(blocksData);
                                  ~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:663:27 - error TS2345: Argument of type '{ name: BlockToolName; data: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    663       document.initialize(blocksData);
                                  ~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:733:27 - error TS2345: Argument of type '{ name: BlockToolName; data: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    733       document.initialize(blocksData);
                                  ~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:776:27 - error TS2345: Argument of type '{ name: BlockToolName; data: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    776       document.initialize(blocksData);
                                  ~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:847:27 - error TS2345: Argument of type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    847       document.initialize([ blockData ]);
                                  ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:889:27 - error TS2345: Argument of type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    889       document.initialize([ blockData ]);
                                  ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:936:27 - error TS2345: Argument of type '{ name: BlockToolName; data: {}; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: {}; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    936       document.initialize([ blockData ]);
                                  ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:988:27 - error TS2345: Argument of type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    988       document.initialize([ blockData ]);
                                  ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:1046:27 - error TS2345: Argument of type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    1046       document.initialize([ blockData ]);
                                   ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:1111:27 - error TS2345: Argument of type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    1111       document.initialize([ blockData ]);
                                   ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:1176:27 - error TS2345: Argument of type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    1176       document.initialize([ blockData ]);
                                   ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.
    src/entities/EditorDocument/EditorDocument.spec.ts:1230:27 - error TS2345: Argument of type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' is not assignable to parameter of type 'Partial<EditorDocumentSerialized> & Pick<EditorDocumentSerialized, "blocks">'.
      Property 'blocks' is missing in type '{ name: BlockToolName; data: { [x: string]: { $t: string; value: string; }; }; }[]' but required in type 'Pick<EditorDocumentSerialized, "blocks">'.

    1230       document.initialize([ blockData ]);
                                   ~~~~~~~~~~~~~

      src/entities/EditorDocument/types/EditorDocumentSerialized.ts:18:3
        18   blocks: BlockNodeSerialized[];
             ~~~~~~
        'blocks' is declared here.


  ● EditorJSModel › should expose only the public API

    expect(received).toEqual(expected) // deep equality

    - Expected  - 1
    + Received  + 1

    @@ -1,7 +1,8 @@
      Array [
        "addBlock",
    +   "clearBlocks",
        "constructor",
        "createCaret",
        "devModeGetDocument",
        "format",
        "getFragments",
    @@ -10,11 +11,10 @@
        "initializeDocument",
        "insertData",
        "insertText",
        "length",
        "modifyData",
    -   "moveBlock",
        "properties",
        "removeBlock",
        "removeCaret",
        "removeData",
        "removeText",

      36 |     const ownProperties = Object.getOwnPropertyNames(EditorJSModel.prototype);
      37 |
    > 38 |     expect(ownProperties.sort()).toEqual(allowedMethods.sort());
         |                                  ^
      39 |   });
      40 |
      41 |   describe('Caret updates on remote operations', () => {

      at Object.<anonymous> (src/EditorJSModel.spec.ts:38:34)

Report generated by 🧪jest coverage report action from 4fa0cd4

Copy link

Coverage report for ./packages/ot-server

St.
Category Percentage Covered / Total
🟡 Statements 70.97% 22/31
🔴 Branches 20% 1/5
🟡 Functions 75% 6/8
🟡 Lines 68.97% 20/29

Test suite run success

4 tests passing in 1 suite.

Report generated by 🧪jest coverage report action from 4fa0cd4

Copy link

Coverage report for ./packages/collaboration-manager

St.
Category Percentage Covered / Total
🟡 Statements 67.51% 160/237
🟢 Branches 80% 60/75
🔴 Functions 57.14% 20/35
🟡 Lines 67.52% 158/234

Test suite run success

67 tests passing in 4 suites.

Report generated by 🧪jest coverage report action from 4fa0cd4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant