@genesislcap/blank-app-seed 3.30.0-prerelease.3 → 3.30.0-prerelease.5
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/.genx/package.json +1 -1
- package/.genx/templates/react/component/component.hbs +6 -6
- package/.genx/templates/react/component/component.index.hbs +1 -1
- package/.genx/templates/react/route.hbs +1 -1
- package/.genx/utils/generateRoute.js +7 -6
- package/.genx/utils/generateTile.js +30 -15
- package/.genx/versions.json +1 -1
- package/CHANGELOG.md +14 -0
- package/client-tmp/react/.babelrc +9 -0
- package/client-tmp/react/jest.config.js +10 -0
- package/client-tmp/react/jest.setup.js +1 -0
- package/client-tmp/react/package.json +10 -4
- package/client-tmp/react/src/App.tsx +1 -1
- package/client-tmp/react/src/components/{ErrorMessage.test.js → ErrorMessage/ErrorMessage.test.js} +17 -0
- package/client-tmp/react/src/pages/AuthPage/AuthPage.test.js +10 -0
- package/client-tmp/react/src/pages/NotPermittedPage/NotPermittedPage.test.js +18 -0
- package/package.json +1 -1
package/.genx/package.json
CHANGED
|
@@ -2,21 +2,21 @@ import { getUser } from '@genesislcap/foundation-user';
|
|
|
2
2
|
import { getViewUpdateRightComponent } from '../../../utils';
|
|
3
3
|
import ErrorMessage from '../../../components/ErrorMessage/ErrorMessage';
|
|
4
4
|
{{#if tile.config.createFormUiSchema}}
|
|
5
|
-
import { createFormSchema as createFormSchemaTile } from './{{
|
|
5
|
+
import { createFormSchema as createFormSchemaTile } from './{{pascalCase tile.title}}CreateFormSchema';
|
|
6
6
|
{{/if}}
|
|
7
7
|
{{#if tile.config.uischema}}
|
|
8
|
-
import { createFormSchema as createFormSchemaTile } from './{{
|
|
8
|
+
import { createFormSchema as createFormSchemaTile } from './{{pascalCase tile.title}}CreateFormSchema';
|
|
9
9
|
{{/if}}
|
|
10
10
|
{{#if tile.config.updateFormUiSchema}}
|
|
11
|
-
import { updateFormSchema as updateFormSchemaTile } from './{{
|
|
11
|
+
import { updateFormSchema as updateFormSchemaTile } from './{{pascalCase tile.title}}UpdateFormSchema';
|
|
12
12
|
{{/if}}
|
|
13
13
|
{{#if tile.config.columns}}
|
|
14
|
-
import { columnDefs as columnDefsTile } from './{{
|
|
14
|
+
import { columnDefs as columnDefsTile } from './{{pascalCase tile.title}}ColumnDefs';
|
|
15
15
|
{{/if}}
|
|
16
16
|
{{#if tile.config.gridOptions}}
|
|
17
|
-
import { gridOptions as gridOptionsTile } from './{{
|
|
17
|
+
import { gridOptions as gridOptionsTile } from './{{pascalCase tile.title}}GridOptions';
|
|
18
18
|
{{/if}}
|
|
19
|
-
import './{{
|
|
19
|
+
import './{{pascalCase tile.title}}Component.css';
|
|
20
20
|
|
|
21
21
|
export const {{pascalCase tile.componentName}} = () => {
|
|
22
22
|
const hasUserPermission = (permissionCode) => getViewUpdateRightComponent(getUser(), permissionCode);{{#if tile.config.createFormUiSchema}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './{{
|
|
1
|
+
export * from './{{pascalCase tile.title}}Component.jsx';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './{{pascalCase route.name}}.css';
|
|
2
2
|
{{#each route.tiles}}
|
|
3
|
-
import { {{pascalCase this.componentName}} } from './{{
|
|
3
|
+
import { {{pascalCase this.componentName}} } from './{{pascalCase this.title}}{{pascalCase this.componentType}}';
|
|
4
4
|
{{/each}}
|
|
5
5
|
|
|
6
6
|
const {{pascalCase route.name}} = () => {
|
|
@@ -14,7 +14,7 @@ const getPathByFramework = {
|
|
|
14
14
|
route: (clientSrcPath, routeName) => `${clientSrcPath}/${routeName}`,
|
|
15
15
|
component: (routeDir, routeName) => `${routeDir}/${routeName}.ts`,
|
|
16
16
|
template: (routeDir, routeName) => `${routeDir}/${routeName}.template.ts`,
|
|
17
|
-
style: (
|
|
17
|
+
style: (routeDir, routeName) => `${routeDir}/${routeName}.styles.ts`,
|
|
18
18
|
},
|
|
19
19
|
[FRAMEWORK_ANGULAR_ALIAS]: {
|
|
20
20
|
clientSrcPath: `../../client/src/app/pages`,
|
|
@@ -22,15 +22,16 @@ const getPathByFramework = {
|
|
|
22
22
|
component: (routeDir, routeName) => `${routeDir}/${routeName}.component.ts`,
|
|
23
23
|
template: (routeDir, routeName) =>
|
|
24
24
|
`${routeDir}/${routeName}.component.html`,
|
|
25
|
-
style: (
|
|
25
|
+
style: (routeDir, routeName) => `${routeDir}/${routeName}.component.css`,
|
|
26
26
|
},
|
|
27
27
|
[FRAMEWORK_REACT_ALIAS]: {
|
|
28
28
|
clientSrcPath: `../../client/src/pages`,
|
|
29
|
-
route: (clientSrcPath, routeName) =>
|
|
29
|
+
route: (clientSrcPath, routeName, changeCase) =>
|
|
30
|
+
`${clientSrcPath}/${changeCase.pascalCase(routeName)}`,
|
|
30
31
|
component: (routeDir, routeName, changeCase) =>
|
|
31
32
|
`${routeDir}/${changeCase.pascalCase(routeName)}.jsx`,
|
|
32
|
-
style: (
|
|
33
|
-
`${
|
|
33
|
+
style: (routeDir, routeName, changeCase) =>
|
|
34
|
+
`${routeDir}/${changeCase.pascalCase(routeName)}.css`,
|
|
34
35
|
},
|
|
35
36
|
};
|
|
36
37
|
|
|
@@ -44,7 +45,7 @@ const generateRoute = (route, { changeCase, writeFileWithData }, framework) => {
|
|
|
44
45
|
} = getPathByFramework[framework];
|
|
45
46
|
const routeName = changeCase.paramCase(route.name);
|
|
46
47
|
const sourceTemplateDir = `../${DIR_TEMPLATE_BY_FRAMEWORK[framework]}`;
|
|
47
|
-
const routeDir = getRouteDir(clientSrcPath, routeName);
|
|
48
|
+
const routeDir = getRouteDir(clientSrcPath, routeName, changeCase);
|
|
48
49
|
|
|
49
50
|
const filesToWrite = [
|
|
50
51
|
{
|
|
@@ -46,16 +46,30 @@ const getPathByFramework = {
|
|
|
46
46
|
...defaultPathGetters,
|
|
47
47
|
index: (componentPath) => `${componentPath}/index.jsx`,
|
|
48
48
|
clientSrcPath: `../../client/src/pages`,
|
|
49
|
-
route: (clientSrcPath, tile, routeName) =>
|
|
50
|
-
`${clientSrcPath}/${routeName}/${tile.name}
|
|
51
|
-
component: (componentPath, tile) =>
|
|
52
|
-
`${componentPath}/${tile.name}.
|
|
53
|
-
style: (componentPath, tile) =>
|
|
54
|
-
`${componentPath}/${tile.name}.
|
|
49
|
+
route: (clientSrcPath, tile, routeName, changeCase) =>
|
|
50
|
+
`${clientSrcPath}/${changeCase.pascalCase(routeName)}/${changeCase.pascalCase(tile.name)}${changeCase.pascalCase(tile.componentType)}`,
|
|
51
|
+
component: (componentPath, tile, changeCase) =>
|
|
52
|
+
`${componentPath}/${changeCase.pascalCase(tile.name)}Component.jsx`,
|
|
53
|
+
style: (componentPath, tile, changeCase) =>
|
|
54
|
+
`${componentPath}/${changeCase.pascalCase(tile.name)}Component.css`,
|
|
55
|
+
addForm: (componentPath, tile, changeCase) =>
|
|
56
|
+
`${componentPath}/${changeCase.pascalCase(tile.name)}CreateFormSchema.ts`,
|
|
57
|
+
updateForm: (componentPath, tile, changeCase) =>
|
|
58
|
+
`${componentPath}/${changeCase.pascalCase(tile.name)}UpdateFormSchema.ts`,
|
|
59
|
+
columnDefs: (componentPath, tile, changeCase) =>
|
|
60
|
+
`${componentPath}/${changeCase.pascalCase(tile.name)}ColumnDefs.ts`,
|
|
61
|
+
gridOptions: (componentPath, tile, changeCase) =>
|
|
62
|
+
`${componentPath}/${changeCase.pascalCase(tile.name)}GridOptions.ts`,
|
|
55
63
|
},
|
|
56
64
|
};
|
|
57
65
|
|
|
58
|
-
const getFilesToWrite = (
|
|
66
|
+
const getFilesToWrite = (
|
|
67
|
+
tileData,
|
|
68
|
+
routeName,
|
|
69
|
+
path,
|
|
70
|
+
sourceTemplateDir,
|
|
71
|
+
changeCase,
|
|
72
|
+
) => {
|
|
59
73
|
const {
|
|
60
74
|
clientSrcPath,
|
|
61
75
|
route: getRouteDir,
|
|
@@ -69,7 +83,7 @@ const getFilesToWrite = (tileData, routeName, path, sourceTemplateDir) => {
|
|
|
69
83
|
gridOptions: getGridOptionsTarget,
|
|
70
84
|
} = path;
|
|
71
85
|
|
|
72
|
-
const routeDir = getRouteDir(clientSrcPath, tileData, routeName);
|
|
86
|
+
const routeDir = getRouteDir(clientSrcPath, tileData, routeName, changeCase);
|
|
73
87
|
|
|
74
88
|
const componentIndexFile = {
|
|
75
89
|
source: `${sourceTemplateDir}/component/component.index.hbs`,
|
|
@@ -78,32 +92,32 @@ const getFilesToWrite = (tileData, routeName, path, sourceTemplateDir) => {
|
|
|
78
92
|
|
|
79
93
|
const componentFile = {
|
|
80
94
|
source: `${sourceTemplateDir}/component/component.hbs`,
|
|
81
|
-
target: getComponentTarget(routeDir, tileData),
|
|
95
|
+
target: getComponentTarget(routeDir, tileData, changeCase),
|
|
82
96
|
};
|
|
83
97
|
|
|
84
98
|
const componentStylesFile = {
|
|
85
99
|
source: `${sourceTemplateDir}/component/component.styles.hbs`,
|
|
86
|
-
target: getStyleTarget(routeDir, tileData),
|
|
100
|
+
target: getStyleTarget(routeDir, tileData, changeCase),
|
|
87
101
|
};
|
|
88
102
|
|
|
89
103
|
const componentAddFormFile = {
|
|
90
104
|
source: `${sourceTemplateDir}/component/component.create.form.hbs`,
|
|
91
|
-
target: getAddFormTarget(routeDir, tileData),
|
|
105
|
+
target: getAddFormTarget(routeDir, tileData, changeCase),
|
|
92
106
|
};
|
|
93
107
|
|
|
94
108
|
const componentUpdateFormFile = {
|
|
95
109
|
source: `${sourceTemplateDir}/component/component.update.form.hbs`,
|
|
96
|
-
target: getUpdateFormTarget(routeDir, tileData),
|
|
110
|
+
target: getUpdateFormTarget(routeDir, tileData, changeCase),
|
|
97
111
|
};
|
|
98
112
|
|
|
99
113
|
const componentColumnsFile = {
|
|
100
114
|
source: `${sourceTemplateDir}/component/component.column.defs.hbs`,
|
|
101
|
-
target: getColumnDefsTarget(routeDir, tileData),
|
|
115
|
+
target: getColumnDefsTarget(routeDir, tileData, changeCase),
|
|
102
116
|
};
|
|
103
117
|
|
|
104
118
|
const componentGridOptionsFile = {
|
|
105
119
|
source: `${sourceTemplateDir}/component/component.gridOptions.hbs`,
|
|
106
|
-
target: getGridOptionsTarget(routeDir, tileData),
|
|
120
|
+
target: getGridOptionsTarget(routeDir, tileData, changeCase),
|
|
107
121
|
};
|
|
108
122
|
|
|
109
123
|
const filesToWrite = [componentIndexFile, componentFile, componentStylesFile];
|
|
@@ -160,13 +174,14 @@ const generateTile = (
|
|
|
160
174
|
const routeName = changeCase.paramCase(route.name);
|
|
161
175
|
const sourceTemplateDir = `../${DIR_TEMPLATE_BY_FRAMEWORK[framework]}`;
|
|
162
176
|
const { clientSrcPath, route: getRouteDir } = getPathByFramework[framework];
|
|
163
|
-
const routeDir = getRouteDir(clientSrcPath, tileData, routeName);
|
|
177
|
+
const routeDir = getRouteDir(clientSrcPath, tileData, routeName, changeCase);
|
|
164
178
|
|
|
165
179
|
const filesToWrite = getFilesToWrite(
|
|
166
180
|
tileData,
|
|
167
181
|
routeName,
|
|
168
182
|
getPathByFramework[framework],
|
|
169
183
|
sourceTemplateDir,
|
|
184
|
+
changeCase,
|
|
170
185
|
);
|
|
171
186
|
|
|
172
187
|
makeDirectory(resolve(__dirname, routeDir));
|
package/.genx/versions.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.30.0-prerelease.5](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.30.0-prerelease.4...v3.30.0-prerelease.5) (2024-09-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* automated dependency version update [skip-ci] [PSD-9](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/9) (#341) 1d38563
|
|
9
|
+
|
|
10
|
+
## [3.30.0-prerelease.4](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.30.0-prerelease.3...v3.30.0-prerelease.4) (2024-09-06)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add unit tests - [FUI-2173](https://github.com/genesiscommunitysuccess/blank-app-seed/issues/2173) (#332) a4168f3
|
|
16
|
+
|
|
3
17
|
## [3.30.0-prerelease.3](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v3.30.0-prerelease.2...v3.30.0-prerelease.3) (2024-09-06)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'jsdom',
|
|
3
|
+
moduleFileExtensions: ['js', 'jsx'],
|
|
4
|
+
transform: {
|
|
5
|
+
'^.+\\.jsx?$': 'babel-jest',
|
|
6
|
+
},
|
|
7
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
8
|
+
testMatch: ["**/?(*.)+(test).[jt]s?(x)"],
|
|
9
|
+
watchPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/dist/"],
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"lint:fix": "eslint src/**/*.js src/**/*.jsx --fix",
|
|
20
20
|
"lint:eslint": "npm lint",
|
|
21
21
|
"lint:stylelint": "node lint-css.js",
|
|
22
|
-
"test": "
|
|
22
|
+
"test": "jest",
|
|
23
|
+
"test:coverage": "jest --coverage",
|
|
24
|
+
"test:unit:watch": "jest --watchAll",
|
|
23
25
|
"test:e2e": "genx test --e2e",
|
|
24
26
|
"test:e2e:debug": "genx test --e2e --debug",
|
|
25
|
-
"test:e2e:ui": "genx test --e2e --interactive"
|
|
26
|
-
"test:coverage": "genx test --no-watch --coverage",
|
|
27
|
-
"test:unit:watch": "genx test --watch"
|
|
27
|
+
"test:e2e:ui": "genx test --e2e --interactive"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@ag-grid-community/client-side-row-model": "29.2.0",
|
|
@@ -51,6 +51,9 @@
|
|
|
51
51
|
"react-router-dom": "6.24.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
+
"@babel/core": "^7.25.2",
|
|
55
|
+
"@babel/preset-env": "^7.25.4",
|
|
56
|
+
"@babel/preset-react": "^7.24.7",
|
|
54
57
|
"@genesislcap/design-system-configurator": "{{versions.UI}}",
|
|
55
58
|
"@genesislcap/eslint-config": "{{versions.UI}}",
|
|
56
59
|
"@genesislcap/prettier-config": "{{versions.UI}}",
|
|
@@ -66,9 +69,12 @@
|
|
|
66
69
|
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
67
70
|
"@typescript-eslint/parser": "^7.13.1",
|
|
68
71
|
"@vitejs/plugin-react": "^4.3.1",
|
|
72
|
+
"babel-plugin-react-require": "^4.0.3",
|
|
69
73
|
"eslint": "^8.57.0",
|
|
70
74
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
71
75
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
76
|
+
"jest": "^29.7.0",
|
|
77
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
72
78
|
"typescript": "^5.2.2",
|
|
73
79
|
"vite": "^5.3.1"
|
|
74
80
|
},
|
|
@@ -15,7 +15,7 @@ import { AuthProvider } from './store/AuthContext';
|
|
|
15
15
|
import AuthPage from './pages/AuthPage/AuthPage';
|
|
16
16
|
import NotPermittedPage from './pages/NotPermittedPage/NotPermittedPage';
|
|
17
17
|
{{#each routes}}
|
|
18
|
-
import {{pascalCase this.name}} from './pages/{{
|
|
18
|
+
import {{pascalCase this.name}} from './pages/{{pascalCase this.name}}/{{pascalCase this.name}}';
|
|
19
19
|
{{/each}}
|
|
20
20
|
|
|
21
21
|
// Genesis Components
|
package/client-tmp/react/src/components/{ErrorMessage.test.js → ErrorMessage/ErrorMessage.test.js}
RENAMED
|
@@ -77,4 +77,21 @@ describe('ErrorMessage Component', () => {
|
|
|
77
77
|
expect(displayedMessage.tagName).toBe(elementType.toUpperCase());
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
|
+
|
|
81
|
+
test('renders the message as a div element when elementType is unknown', () => {
|
|
82
|
+
render(<ErrorMessage message={message} elementType="unknown" />);
|
|
83
|
+
const displayedMessage = screen.getByText(message);
|
|
84
|
+
expect(displayedMessage.tagName).toBe('DIV');
|
|
85
|
+
expect(displayedMessage).toBeInTheDocument();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('renders nothing if the message is null', () => {
|
|
89
|
+
const { container } = render(<ErrorMessage message={null} />);
|
|
90
|
+
expect(container.firstChild).toBeNull();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('renders nothing if the message is undefined', () => {
|
|
94
|
+
const { container } = render(<ErrorMessage message={undefined} />);
|
|
95
|
+
expect(container.firstChild).toBeNull();
|
|
96
|
+
});
|
|
80
97
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import AuthPage from './AuthPage';
|
|
3
|
+
|
|
4
|
+
test('renders AuthPage component', () => {
|
|
5
|
+
const { container } = render(<AuthPage />);
|
|
6
|
+
const authPageElement = container.querySelector('.auth-page');
|
|
7
|
+
expect(authPageElement).toBeInTheDocument();
|
|
8
|
+
const clientAppLoginElement = container.querySelector('client-app-login');
|
|
9
|
+
expect(clientAppLoginElement).toBeInTheDocument();
|
|
10
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import NotPermittedPage from './NotPermittedPage';
|
|
4
|
+
|
|
5
|
+
jest.mock('../../components/ErrorMessage/ErrorMessage', () => {
|
|
6
|
+
return jest.fn((props) => <h1 data-testid="error-message">{props.message}</h1>);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
describe('NotPermittedPage Component', () => {
|
|
10
|
+
test('renders the ErrorMessage component with correct props', () => {
|
|
11
|
+
render(<NotPermittedPage />);
|
|
12
|
+
|
|
13
|
+
const errorMessage = screen.getByTestId('error-message');
|
|
14
|
+
expect(errorMessage).toBeInTheDocument();
|
|
15
|
+
expect(errorMessage.tagName).toBe('H1');
|
|
16
|
+
expect(errorMessage).toHaveTextContent('You do not have permission to access this part of the application, please contact your administrator.');
|
|
17
|
+
});
|
|
18
|
+
});
|