Skip to content
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

BUG: errors in testfiles #23

Open
lightningRalf opened this issue May 18, 2024 · 0 comments
Open

BUG: errors in testfiles #23

lightningRalf opened this issue May 18, 2024 · 0 comments

Comments

@lightningRalf
Copy link
Owner

npm run test

[email protected] test
jest

FAIL node tests/node/connectObjects.test.ts
● Test suite failed to run

Cannot find module 'src/main' from 'src/ExcalidrawAutomate.ts'                                                                                                                     
                                                                                                                                                                                   
Require stack:                                                                                                                                                                     
  src/ExcalidrawAutomate.ts                                                                                                                                                        
  __tests__/node/connectObjects.test.ts                                                                                                                                            
                                                                                                                                                                                   
> 1 | import ExcalidrawPlugin from "src/main";                                                                                                                                     
    | ^
  2 | export { ExcalidrawPlugin };
  3 | import {
  4 |   FillStyle,

  at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
  at Object.require (src/ExcalidrawAutomate.ts:1:1)
  at Object.<anonymous> (__tests__/node/connectObjects.test.ts:1:1)

FAIL jsdom tests/jsdom/ExcalidrawData.test.ts
● Test suite failed to run

__tests__/jsdom/ExcalidrawData.test.ts:16:31 - error TS2345: Argument of type 'App' is not assignable to parameter of type 'ExcalidrawPlugin'.
  Type 'App' is missing the following properties from type 'ExcalidrawPlugin': excalidrawConfig, taskbone, excalidrawFiles, excalidrawFileModes, and 104 more.

16     data = new ExcalidrawData(app);
                                 ~~~
__tests__/jsdom/ExcalidrawData.test.ts:28:43 - error TS2345: Argument of type 'boolean' is not assignable to parameter of type 'TFile'.

28       await data.loadData("mockFilePath", false, "text");
                                             ~~~~~
__tests__/jsdom/ExcalidrawData.test.ts:37:25 - error TS2554: Expected 3 arguments, but got 1.

37       await expect(data.loadData(file)).rejects.toThrow("File read error");
                           ~~~~~~~~

  src/ExcalidrawData.ts:597:5
    597     file: TFile,
            ~~~~~~~~~~~
    An argument for 'file' was not provided.

FAIL jsdom tests/jsdom/ExcalidrawView.test.ts
● Test suite failed to run

__tests__/jsdom/ExcalidrawView.test.ts:12:5 - error TS2740: Type 'WorkspaceMock' is missing the following properties from type 'Workspace': leftSplit, rightSplit, leftRibbon, rightRibbon, and 34 more.                                                                                                                                                                  
                                                                                                                                                                                   
12     global.app.workspace = new Workspace();                                                                                                                                     
       ~~~~~~~~~~~~~~~~~~~~                                                                                                                                                        
__tests__/jsdom/ExcalidrawView.test.ts:16:47 - error TS2339: Property 'activeLeaf' does not exist on type 'typeof WorkspaceMock'.                                                  

16     const view = new ExcalidrawView(Workspace.activeLeaf, App);
                                                 ~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:16:59 - error TS2345: Argument of type 'typeof AppMock' is not assignable to parameter of type 'ExcalidrawPlugin'.
  Type 'typeof AppMock' is missing the following properties from type 'ExcalidrawPlugin': excalidrawConfig, taskbone, excalidrawFiles, excalidrawFileModes, and 104 more.

16     const view = new ExcalidrawView(Workspace.activeLeaf, App);
                                                             ~~~
__tests__/jsdom/ExcalidrawView.test.ts:17:45 - error TS2345: Argument of type 'typeof AppMock' is not assignable to parameter of type 'ExcalidrawPlugin'.

17     const automate = new ExcalidrawAutomate(App, view);
                                               ~~~
__tests__/jsdom/ExcalidrawView.test.ts:20:10 - error TS2339: Property 'toggleViewMode' does not exist on type 'ExcalidrawView'.

20     view.toggleViewMode = jest.fn();
            ~~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:23:14 - error TS2339: Property 'toggleViewMode' does not exist on type 'ExcalidrawAutomate'.

23     automate.toggleViewMode();
                ~~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:26:17 - error TS2339: Property 'toggleViewMode' does not exist on type 'ExcalidrawView'.

26     expect(view.toggleViewMode).toHaveBeenCalled();
                   ~~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:30:47 - error TS2339: Property 'activeLeaf' does not exist on type 'typeof WorkspaceMock'.

30     const view = new ExcalidrawView(Workspace.activeLeaf, App);
                                                 ~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:30:59 - error TS2345: Argument of type 'typeof AppMock' is not assignable to parameter of type 'ExcalidrawPlugin'.

30     const view = new ExcalidrawView(Workspace.activeLeaf, App);
                                                             ~~~
__tests__/jsdom/ExcalidrawView.test.ts:31:45 - error TS2345: Argument of type 'typeof AppMock' is not assignable to parameter of type 'ExcalidrawPlugin'.

31     const automate = new ExcalidrawAutomate(App, view);
                                               ~~~
__tests__/jsdom/ExcalidrawView.test.ts:34:10 - error TS2339: Property 'selectElement' does not exist on type 'ExcalidrawView'.

34     view.selectElement = jest.fn();
            ~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:37:14 - error TS2551: Property 'selectElement' does not exist on type 'ExcalidrawAutomate'. Did you mean 'getElement'?

37     automate.selectElement('element-id');
                ~~~~~~~~~~~~~

  src/ExcalidrawAutomate.ts:591:3
    591   getElement(id: string): Mutable<ExcalidrawElement> {
          ~~~~~~~~~~
    'getElement' is declared here.
__tests__/jsdom/ExcalidrawView.test.ts:40:17 - error TS2339: Property 'selectElement' does not exist on type 'ExcalidrawView'.

40     expect(view.selectElement).toHaveBeenCalledWith('element-id');
                   ~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:44:47 - error TS2339: Property 'activeLeaf' does not exist on type 'typeof WorkspaceMock'.

44     const view = new ExcalidrawView(Workspace.activeLeaf, App);
                                                 ~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:44:59 - error TS2345: Argument of type 'typeof AppMock' is not assignable to parameter of type 'ExcalidrawPlugin'.

44     const view = new ExcalidrawView(Workspace.activeLeaf, App);
                                                             ~~~
__tests__/jsdom/ExcalidrawView.test.ts:45:45 - error TS2345: Argument of type 'typeof AppMock' is not assignable to parameter of type 'ExcalidrawPlugin'.

45     const automate = new ExcalidrawAutomate(App, view);
                                               ~~~
__tests__/jsdom/ExcalidrawView.test.ts:48:10 - error TS2339: Property 'updateDrawing' does not exist on type 'ExcalidrawView'.

48     view.updateDrawing = jest.fn();
            ~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:51:14 - error TS2339: Property 'updateDrawing' does not exist on type 'ExcalidrawAutomate'.

51     automate.updateDrawing([]);
                ~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawView.test.ts:54:17 - error TS2339: Property 'updateDrawing' does not exist on type 'ExcalidrawView'.

54     expect(view.updateDrawing).toHaveBeenCalledWith([]);
                   ~~~~~~~~~~~~~

FAIL jsdom tests/jsdom/ExcalidrawAutomate.test.ts
● Test suite failed to run

__tests__/jsdom/ExcalidrawAutomate.test.ts:10:18 - error TS2740: Type 'typeof AppMock' is missing the following properties from type 'App': keymap, scope, workspace, vault, and 7 more.                                                                                                                                                                                  
                                                                                                                                                                                   
10     global.app = App;                                                                                                                                                           
                    ~~~                                                                                                                                                            
                                                                                                                                                                                   
  __tests__/jsdom/ExcalidrawAutomate.test.ts:10:18
    10     global.app = App;
                        ~~~
    Did you mean to use 'new' with this expression?
__tests__/jsdom/ExcalidrawAutomate.test.ts:11:24 - error TS2740: Type 'typeof VaultMock' is missing the following properties from type 'Vault': adapter, configDir, getName, getFileByPath, and 27 more.

11     global.app.vault = Vault;
                          ~~~~~

  __tests__/jsdom/ExcalidrawAutomate.test.ts:11:24
    11     global.app.vault = Vault;
                              ~~~~~
    Did you mean to use 'new' with this expression?
__tests__/jsdom/ExcalidrawAutomate.test.ts:12:32 - error TS2740: Type 'typeof MetadataCacheMock' is missing the following properties from type 'MetadataCache': getFirstLinkpathDest, getFileCache, getCache, fileToLinktext, and 10 more.

12     global.app.metadataCache = MetadataCache;
                                  ~~~~~~~~~~~~~

  __tests__/jsdom/ExcalidrawAutomate.test.ts:12:32
    12     global.app.metadataCache = MetadataCache;
                                      ~~~~~~~~~~~~~
    Did you mean to use 'new' with this expression?
__tests__/jsdom/ExcalidrawAutomate.test.ts:13:5 - error TS2740: Type 'typeof WorkspaceMock' is missing the following properties from type 'Workspace': leftSplit, rightSplit, leftRibbon, rightRibbon, and 40 more.

13     global.app.workspace = Workspace;
       ~~~~~~~~~~~~~~~~~~~~
__tests__/jsdom/ExcalidrawAutomate.test.ts:15:33 - error TS2345: Argument of type 'typeof AppMock' is not assignable to parameter of type 'ExcalidrawPlugin'.
  Type 'typeof AppMock' is missing the following properties from type 'ExcalidrawPlugin': excalidrawConfig, taskbone, excalidrawFiles, excalidrawFileModes, and 104 more.

15     ea = new ExcalidrawAutomate(App);
                                   ~~~
__tests__/jsdom/ExcalidrawAutomate.test.ts:30:20 - error TS2339: Property 'create' does not exist on type 'typeof VaultMock'.

30       expect(Vault.create).toHaveBeenCalledWith(expect.stringContaining(foldername + "/" + filename), expect.stringContaining(content));
                      ~~~~~~
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

No branches or pull requests

1 participant