piral-dashboard 0.15.0-alpha.4396 → 0.15.0-beta.4411

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-dashboard",
3
- "version": "0.15.0-alpha.4396",
3
+ "version": "0.15.0-beta.4411",
4
4
  "description": "Plugin for creating a centralized dashboard in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -63,12 +63,12 @@
63
63
  "devDependencies": {
64
64
  "@types/react": "^18.0.0",
65
65
  "@types/react-router-dom": "^5.1.6",
66
- "piral-core": "0.15.0-alpha.4396",
66
+ "piral-core": "0.15.0-beta.4411",
67
67
  "react": "^18.0.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "piral-core": "0.14.x || 0.15.x",
71
71
  "react": ">=16.8.0"
72
72
  },
73
- "gitHead": "62abff4d61634b3ecffda2407f1c29f1de929b4c"
73
+ "gitHead": "4f5faf811d34692b5f2d3042b9fb732fa8d64cb0"
74
74
  }
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import create from 'zustand';
3
- import { mount } from 'enzyme';
3
+ import { render } from '@testing-library/react';
4
4
  import { StateContext } from 'piral-core';
5
5
  import { Dashboard } from './Dashboard';
6
6
 
7
- const MockDbContainer: React.FC<any> = ({ children }) => <div>{children}</div>;
7
+ const MockDbContainer: React.FC<any> = ({ children }) => <ul>{children}</ul>;
8
8
  MockDbContainer.displayName = 'MockDbContainer';
9
- const MockDbTile: React.FC<any> = ({ children }) => <div>{children}</div>;
9
+ const MockDbTile: React.FC<any> = ({ children }) => <li>{children}</li>;
10
10
  MockDbTile.displayName = 'MockDbTile';
11
11
 
12
12
  function createMockContainer(tiles = {}) {
@@ -41,13 +41,13 @@ describe('Piral-Dashboard Dashboard component', () => {
41
41
  it('uses container for a connected dashboard', () => {
42
42
  const fake: any = {};
43
43
  const { context } = createMockContainer();
44
- const node = mount(
44
+ const node = render(
45
45
  <StateContext.Provider value={context}>
46
46
  <Dashboard {...fake} />
47
47
  </StateContext.Provider>,
48
48
  );
49
- expect(node.find(MockDbContainer).length).toBe(1);
50
- expect(node.find(MockDbTile).length).toBe(0);
49
+ expect(node.getAllByRole('list').length).toBe(1);
50
+ expect(node.queryByRole('listitem')).toBe(null);
51
51
  });
52
52
 
53
53
  it('uses container and tile for each tile of a connected dashboard', () => {
@@ -62,12 +62,12 @@ describe('Piral-Dashboard Dashboard component', () => {
62
62
  preferences: {},
63
63
  },
64
64
  });
65
- const node = mount(
65
+ const node = render(
66
66
  <StateContext.Provider value={context}>
67
67
  <Dashboard {...fake} />
68
68
  </StateContext.Provider>,
69
69
  );
70
- expect(node.find(MockDbContainer).length).toBe(1);
71
- expect(node.find(MockDbTile).length).toBe(2);
70
+ expect(node.getAllByRole('list').length).toBe(1);
71
+ expect(node.getAllByRole('listitem').length).toBe(2);
72
72
  });
73
73
  });
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { mount } from 'enzyme';
2
+ import { render } from '@testing-library/react';
3
3
  import { DefaultContainer } from './default';
4
4
 
5
5
  jest.mock('piral-core', () => ({
@@ -35,10 +35,10 @@ const state = {
35
35
 
36
36
  (React as any).useMemo = (cb) => cb();
37
37
 
38
- const StubDashboard: React.FC = () => <div />;
38
+ const StubDashboard: React.FC = () => <div role="dashboard" />;
39
39
  StubDashboard.displayName = 'StubDashboard';
40
40
 
41
- const StubTile: React.FC = () => <div />;
41
+ const StubTile: React.FC = () => <div role="tile" />;
42
42
  StubTile.displayName = 'StubTile';
43
43
 
44
44
  describe('Default Dashboard Component', () => {
@@ -47,13 +47,13 @@ describe('Default Dashboard Component', () => {
47
47
  component: StubTile,
48
48
  preferences: {},
49
49
  };
50
- const node = mount(
51
- <DefaultContainer history={undefined} location={undefined} match={undefined}>
50
+ const node = render(
51
+ <DefaultContainer>
52
52
  <StubTile />
53
53
  </DefaultContainer>,
54
54
  );
55
- expect(node.find(StubDashboard).length).toBe(0);
56
- expect(node.find(StubTile).length).toBe(1);
55
+ expect(node.queryByRole("dashboard")).toBe(null);
56
+ expect(node.getAllByRole("tile").length).toBe(1);
57
57
  });
58
58
 
59
59
  it('renders the provided extension in the default case', () => {
@@ -62,12 +62,12 @@ describe('Default Dashboard Component', () => {
62
62
  component: StubDashboard,
63
63
  },
64
64
  ];
65
- const node = mount(
66
- <DefaultContainer history={undefined} location={undefined} match={undefined}>
65
+ const node = render(
66
+ <DefaultContainer>
67
67
  <StubTile />
68
68
  </DefaultContainer>,
69
69
  );
70
- expect(node.find(StubTile).length).toBe(0);
71
- expect(node.find(StubDashboard).length).toBe(1);
70
+ expect(node.queryByRole("tile")).toBe(null);
71
+ expect(node.getAllByRole("dashboard").length).toBe(1);
72
72
  });
73
73
  });