@corva/create-app 0.114.0 → 0.116.0

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.
@@ -2,47 +2,13 @@ import { render, screen } from '@testing-library/react';
2
2
  import { AppTestWrapper } from '@corva/ui/testing';
3
3
 
4
4
  import App from '../App';
5
- import { mockApp, mockUser, mockAppHeaderProps } from '../__mocks__/mockData';
5
+ import { mockAppSettings } from '../__mocks__/mockData';
6
6
 
7
7
  describe('<App />', () => {
8
8
  it('should show correct layout', () => {
9
9
  render(
10
- <AppTestWrapper
11
- app={{}}
12
- appId={123}
13
- maximized={false}
14
- appSettings={{}}
15
- onSettingChange={() => {
16
- /* noop */
17
- }}
18
- >
19
- <App
20
- app={mockApp}
21
- package="test"
22
- coordinates={{ w: 0, h: 0, x: 0, y: 0, pixelHeight: 0, pixelWidth: 0 }}
23
- currentUser={mockUser}
24
- devCenterRouter={{ location: { pathname: '', query: {} } }}
25
- segment="test"
26
- appHeaderProps={mockAppHeaderProps}
27
- isNative={false}
28
- layoutEnvironment={{ type: 'test', pdfReportMode: false }}
29
- onSettingChange={() => {
30
- /* noop */
31
- }}
32
- onSettingsChange={() => {
33
- /* noop */
34
- }}
35
- setIsFullscreenModalMode={() => Promise.resolve()}
36
- setIsMaximized={() => {
37
- /* noop */
38
- }}
39
- setMainMenuItems={() => {
40
- /* noop */
41
- }}
42
- setSecondaryMenuItems={() => {
43
- /* noop */
44
- }}
45
- />
10
+ <AppTestWrapper appSettings={mockAppSettings}>
11
+ <App />
46
12
  </AppTestWrapper>
47
13
  );
48
14
 
@@ -51,42 +17,8 @@ describe('<App />', () => {
51
17
 
52
18
  it('should show correct layout when settings are not provided', () => {
53
19
  render(
54
- <AppTestWrapper
55
- app={{}}
56
- appId={123}
57
- maximized={false}
58
- appSettings={{}}
59
- onSettingChange={() => {
60
- /* noop */
61
- }}
62
- >
63
- <App
64
- app={mockApp}
65
- package="test"
66
- coordinates={{ w: 0, h: 0, x: 0, y: 0, pixelHeight: 0, pixelWidth: 0 }}
67
- currentUser={mockUser}
68
- devCenterRouter={{ location: { pathname: '', query: {} } }}
69
- segment="test"
70
- appHeaderProps={mockAppHeaderProps}
71
- isNative={false}
72
- layoutEnvironment={{ type: 'test', pdfReportMode: false }}
73
- onSettingChange={() => {
74
- /* noop */
75
- }}
76
- onSettingsChange={() => {
77
- /* noop */
78
- }}
79
- setIsFullscreenModalMode={() => Promise.resolve()}
80
- setIsMaximized={() => {
81
- /* noop */
82
- }}
83
- setMainMenuItems={() => {
84
- /* noop */
85
- }}
86
- setSecondaryMenuItems={() => {
87
- /* noop */
88
- }}
89
- />
20
+ <AppTestWrapper appSettings={{}}>
21
+ <App />
90
22
  </AppTestWrapper>
91
23
  );
92
24
 
@@ -1,24 +1,20 @@
1
1
  import { render, screen, act } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
+ import { AppTestWrapper } from '@corva/ui/testing';
3
4
 
4
5
  import AppSettings from '../AppSettings';
5
- import { mockApp, mockUser, mockAppData } from '../__mocks__/mockData';
6
6
 
7
7
  describe('<AppSettings />', () => {
8
8
  it('should call onChange with a changed setting on settings change', async () => {
9
- const handleSettingsChange = jest.fn();
10
- const handleSettingsChangeAll = jest.fn();
9
+ const handleSettingChange = jest.fn();
11
10
 
12
11
  render(
13
- <AppSettings
14
- app={mockApp}
15
- appData={mockAppData}
16
- settings={{ isExampleCheckboxChecked: true }}
17
- layoutEnvironment={{ type: 'test', pdfReportMode: false }}
18
- currentUser={mockUser}
19
- onSettingChange={handleSettingsChange}
20
- onSettingsChange={handleSettingsChangeAll}
21
- />
12
+ <AppTestWrapper
13
+ appSettings={{ isExampleCheckboxChecked: true }}
14
+ onSettingChange={handleSettingChange}
15
+ >
16
+ <AppSettings />
17
+ </AppTestWrapper>
22
18
  );
23
19
 
24
20
  const exampleCheckbox = screen.getByRole('checkbox', { name: /example/i });
@@ -27,6 +23,6 @@ describe('<AppSettings />', () => {
27
23
  await userEvent.click(exampleCheckbox);
28
24
  });
29
25
 
30
- expect(handleSettingsChange).toBeCalledWith('isExampleCheckboxChecked', false);
26
+ expect(handleSettingChange).toBeCalledWith('isExampleCheckboxChecked', false);
31
27
  });
32
28
  });
@@ -1,3 +1,4 @@
1
+ // DO NOT modify this structure
1
2
  import App from './App';
2
3
  import AppSettings from './AppSettings';
3
4