@corva/create-app 0.0.0-73c49372-test → 0.0.0-ae3a727

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.
Files changed (48) hide show
  1. package/README.md +7 -0
  2. package/bin/create-corva-app.cjs +4 -9
  3. package/lib/commands/release.js +6 -0
  4. package/lib/constants/cli.js +13 -3
  5. package/lib/constants/manifest.js +3 -2
  6. package/lib/constants/package.js +18 -6
  7. package/lib/flows/lib/api.js +3 -9
  8. package/lib/flows/lib/manifest.js +1 -1
  9. package/lib/flows/steps/release/upload-zip-to-corva.js +74 -0
  10. package/lib/flows/steps/zip-file-list-resolve.js +1 -0
  11. package/lib/helpers/cli-version.js +39 -3
  12. package/lib/helpers/manifest.js +9 -1
  13. package/lib/helpers/resolve-app-runtime.js +6 -6
  14. package/lib/helpers/utils.js +7 -1
  15. package/package.json +1 -104
  16. package/template_extensions/corva/.eslintrc +32 -0
  17. package/template_extensions/corva/.github/workflows/develop.yml +2 -0
  18. package/template_extensions/corva/.release-please-manifest.json +3 -0
  19. package/template_extensions/corva/release-please-config.json +10 -0
  20. package/templates/scheduler_data-time/javascript/__tests__/processor.spec.js +1 -1
  21. package/templates/scheduler_data-time/typescript/__tests__/processor.spec.ts +1 -1
  22. package/templates/scheduler_depth/javascript/__tests__/processor.spec.js +1 -1
  23. package/templates/scheduler_depth/typescript/__tests__/processor.spec.ts +1 -1
  24. package/templates/scheduler_natural-time/javascript/__tests__/processor.spec.js +1 -1
  25. package/templates/scheduler_natural-time/typescript/__tests__/processor.spec.ts +1 -1
  26. package/templates/stream_depth/javascript/__tests__/processor.spec.js +1 -1
  27. package/templates/stream_depth/typescript/__tests__/processor.spec.ts +1 -1
  28. package/templates/stream_time/javascript/__tests__/processor.spec.js +1 -1
  29. package/templates/stream_time/typescript/__tests__/processor.spec.ts +1 -1
  30. package/templates/task/javascript/__tests__/processor.spec.js +1 -1
  31. package/templates/task/typescript/__tests__/processor.spec.ts +1 -1
  32. package/templates/ui/javascript/config/jest/setupTests.js +19 -0
  33. package/templates/ui/javascript/src/App.completion.js +30 -31
  34. package/templates/ui/javascript/src/App.css +0 -13
  35. package/templates/ui/javascript/src/App.drilling.js +31 -36
  36. package/templates/ui/javascript/src/__tests__/App.test.js +27 -2
  37. package/templates/ui/typescript/config/jest/setupTests.js +19 -0
  38. package/templates/ui/typescript/src/App.completion.tsx +32 -42
  39. package/templates/ui/typescript/src/App.css +0 -13
  40. package/templates/ui/typescript/src/App.drilling.tsx +32 -41
  41. package/templates/ui/typescript/src/AppSettings.tsx +2 -12
  42. package/templates/ui/typescript/src/__mocks__/mockData.ts +194 -0
  43. package/templates/ui/typescript/src/__tests__/App.test.tsx +80 -6
  44. package/templates/ui/typescript/src/__tests__/AppSettings.test.tsx +14 -3
  45. package/templates/ui/typescript/src/types.ts +618 -0
  46. package/templates/ui/typescript/tsconfig.json +0 -1
  47. package/templates/ui/typescript/src/__mocks__/mockAppProps.ts +0 -590
  48. package/templates/ui/typescript/src/__mocks__/mockAppSettingsProps.ts +0 -290
@@ -0,0 +1,194 @@
1
+ import { AppInstance, AppInstanceData, User, AppHeaderData } from '../types';
2
+
3
+ export const mockApp: AppInstance = {
4
+ app: { app_key: 'test', platform: 'test' },
5
+ id: 1,
6
+ package: {
7
+ manifest: {
8
+ format: 1,
9
+ license: { type: 'test', url: 'test' },
10
+ developer: { name: 'test', identifier: 'test', authors: [] },
11
+ application: {
12
+ type: 'test',
13
+ key: 'test',
14
+ visibility: 'test',
15
+ name: 'test',
16
+ description: 'test',
17
+ summary: 'test',
18
+ category: 'test',
19
+ website: 'test',
20
+ segments: ['test'],
21
+ ui: {
22
+ initial_size: { w: 100, h: 100 },
23
+ multi_rig: false,
24
+ full_screen_report: false,
25
+ use_app_header_v3: false,
26
+ },
27
+ },
28
+ settings: {
29
+ entrypoint: { file: 'test', function: 'test' },
30
+ environment: {},
31
+ runtime: 'test',
32
+ app: { log_type: 'test' },
33
+ enable_isolation: false,
34
+ },
35
+ datasets: {},
36
+ },
37
+ build: 'test',
38
+ version: 'test',
39
+ },
40
+ segment: ['test'],
41
+ settings: {},
42
+ };
43
+
44
+ export const mockUser: User = {
45
+ id: 1,
46
+ company_id: 1,
47
+ first_name: 'Test',
48
+ last_name: 'User',
49
+ email: 'test@test.com',
50
+ mobile: '1234567890',
51
+ created_at: '2023-01-01',
52
+ terms_acceptance_at: '2023-01-01',
53
+ profile_photo: null,
54
+ recently_viewed_asset_ids: [],
55
+ unit_system: null,
56
+ custom_unit_system: null,
57
+ role: 'test',
58
+ title: null,
59
+ group: null,
60
+ favorite_asset_id: null,
61
+ current_segment: 'test',
62
+ theme: 'test',
63
+ messaging_id: 'test',
64
+ restricted_assets: [],
65
+ restricted_programs: [],
66
+ settings: {
67
+ favorites: [],
68
+ home_page: { selected_assets_tab: 'test' },
69
+ onboarded: false,
70
+ beta_2_158: {},
71
+ uiSettings: {},
72
+ singleAsset: {
73
+ padId: 1,
74
+ rigId: 1,
75
+ wellId: null,
76
+ rigAssetId: 1,
77
+ fracFleetId: 1,
78
+ wellAssetId: null,
79
+ drilloutUnitId: 1,
80
+ completionWellAssetId: 1,
81
+ },
82
+ feed_filters: {
83
+ company_id: null,
84
+ start_date: '2023-01-01',
85
+ content_types: [],
86
+ selected_rigs_ids: [],
87
+ selected_user_ids: [],
88
+ users_radio_value: 'test',
89
+ assets_radio_value: 'test',
90
+ date_range_radio_value: 'test',
91
+ },
92
+ sms_blacklisted: false,
93
+ favorit_asset_ids: [],
94
+ restricted_assets: [],
95
+ alerts_list_filters: {
96
+ end_date: '2023-01-01',
97
+ segments: [],
98
+ alert_name: 'test',
99
+ start_date: '2023-01-01',
100
+ validation: 'test',
101
+ alert_levels: [],
102
+ subscription: 'test',
103
+ classification: 'test',
104
+ assets_radio_value: 'test',
105
+ date_range_radio_value: 'test',
106
+ },
107
+ restricted_programs: [],
108
+ is_dnd_feature_shown: false,
109
+ last_new_alerts_check: '2023-01-01',
110
+ notifications_filters: {
111
+ end_date: '2023-01-01',
112
+ start_date: '2023-01-01',
113
+ content_types: [],
114
+ date_range_radio_value: 'test',
115
+ },
116
+ directional_app_settings: {
117
+ curve_to_lat_threshold: 0,
118
+ vert_to_curve_threshold: 0,
119
+ },
120
+ last_new_feed_items_check: '2023-01-01',
121
+ participates_in_beta_apps: false,
122
+ 'cross-plot__gradient-manager': [],
123
+ last_new_dashboard_shares_check: '2023-01-01',
124
+ formation_evaluation_lithology_types: {},
125
+ formation_evaluation_custom_gradients: [],
126
+ },
127
+ last_sign_in_at: '2023-01-01',
128
+ locked_access: false,
129
+ unit_ids: [],
130
+ intercom_admin_id: null,
131
+ resource: [],
132
+ consent_to_process_data: false,
133
+ identity_verification_enabled: null,
134
+ intercom_user_hash: 'test',
135
+ impersonating: false,
136
+ profile_groups: [],
137
+ preference: {
138
+ id: 1,
139
+ push_notifications_enabled: false,
140
+ emails_enabled: false,
141
+ sms_enabled: false,
142
+ alert_levels: [],
143
+ play_alerts_sound: false,
144
+ show_intercom_icon: false,
145
+ segment: [],
146
+ disable_create_dashboard: false,
147
+ disable_costs: false,
148
+ disable_documents: false,
149
+ realtime_operation_mode: false,
150
+ disable_file_upload: false,
151
+ stay_on_app_store: false,
152
+ new_navigation_beta: false,
153
+ new_mobile_app_enabled: false,
154
+ },
155
+ company: {
156
+ id: 1,
157
+ name: 'Test Company',
158
+ time_zone: 'UTC',
159
+ language: 'en',
160
+ provider: 'test',
161
+ unit_system: {},
162
+ custom_unit_system: {},
163
+ custom_units: {},
164
+ dev_center_enabled: false,
165
+ with_subscription: false,
166
+ competitor_analysis_enabled: false,
167
+ ai_model_scope: 'test',
168
+ },
169
+ groups: [],
170
+ };
171
+
172
+ export const mockAppData: AppInstanceData = {
173
+ id: 1,
174
+ rig: null,
175
+ well: null,
176
+ fracFleet: null,
177
+ program: {
178
+ id: null,
179
+ name: null,
180
+ },
181
+ wells: null,
182
+ isLoading: false,
183
+ appHash: 'test',
184
+ };
185
+
186
+ export const mockAppHeaderProps: AppHeaderData = {
187
+ app: mockApp,
188
+ appLastAnnotation: null,
189
+ appSettings: {},
190
+ coordinates: { w: 0, h: 0, x: 0, y: 0, pixelHeight: 0, pixelWidth: 0 },
191
+ currentUser: mockUser,
192
+ isMaximized: false,
193
+ layoutEnvironment: { type: 'test', pdfReportMode: false },
194
+ };
@@ -1,20 +1,94 @@
1
1
  import { render, screen } from '@testing-library/react';
2
+ import { AppTestWrapper } from '@corva/ui/testing';
2
3
 
3
4
  import App from '../App';
4
- import { mockAppProps } from '../__mocks__/mockAppProps';
5
+ import { mockApp, mockUser, mockAppHeaderProps } from '../__mocks__/mockData';
5
6
 
6
7
  describe('<App />', () => {
7
8
  it('should show correct layout', () => {
8
- render(<App {...mockAppProps} />);
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
+ />
46
+ </AppTestWrapper>
47
+ );
9
48
 
10
49
  screen.getByText(/checked/i);
11
50
  });
12
51
 
13
52
  it('should show correct layout when settings are not provided', () => {
14
- const propsWithoutSettings = mockAppProps;
15
- delete propsWithoutSettings.isExampleCheckboxChecked;
16
-
17
- render(<App {...propsWithoutSettings} />);
53
+ 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
+ />
90
+ </AppTestWrapper>
91
+ );
18
92
 
19
93
  screen.getByText(/unchecked/i);
20
94
  });
@@ -2,15 +2,26 @@ import { render, screen, act } from '@testing-library/react';
2
2
  import userEvent from '@testing-library/user-event';
3
3
 
4
4
  import AppSettings from '../AppSettings';
5
- import { mockAppSettingsProps } from '../__mocks__/mockAppSettingsProps';
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
9
  const handleSettingsChange = jest.fn();
10
+ const handleSettingsChangeAll = jest.fn();
10
11
 
11
- render(<AppSettings {...mockAppSettingsProps} onSettingChange={handleSettingsChange} />);
12
+ 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
+ />
22
+ );
12
23
 
13
- const exampleCheckbox = screen.getByTestId('exampleCheckbox').querySelector('input');
24
+ const exampleCheckbox = screen.getByRole('checkbox', { name: /example/i });
14
25
 
15
26
  await act(async () => {
16
27
  await userEvent.click(exampleCheckbox);