@wavemaker-ai/angular-app 12.0.2-rc.647771 → 12.1.0-rc.647821
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/build-scripts/ng-circle-progress-patch.mjs +38 -0
- package/dependencies/expression-parser.cjs.js +11441 -9850
- package/dependencies/pipe-provider.cjs.js +27146 -21371
- package/dependencies/transpilation-web.cjs.js +20627 -17714
- package/dependency-report.html +1 -1
- package/npm-shrinkwrap.json +14855 -15792
- package/package-lock.json +14855 -15792
- package/package.json +43 -47
- package/src/app/app-defaults.spec.ts +39 -0
- package/src/app/prefabs/prefab-config.spec.ts +8 -0
- package/src/framework/services/component-ref-providers.spec.ts +93 -0
- package/src/framework/services/providers.spec.ts +63 -0
- package/src/framework/util/lazy-module-routes.spec.ts +9 -0
- package/src/framework/util/page-util.spec.ts +18 -0
- package/src/polyfills.spec.ts +9 -0
- package/src/setup-jest.js +4 -1
- package/src/wm-namespace.spec.ts +29 -0
- package/tsconfig.json +3 -0
- package/tsconfig.web-app.json +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker-ai/angular-app",
|
|
3
|
-
"version": "12.0
|
|
3
|
+
"version": "12.1.0-rc.647821",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"ng": "ng",
|
|
6
6
|
"start": "./node_modules/.bin/ng serve",
|
|
@@ -14,31 +14,31 @@
|
|
|
14
14
|
"e2e": "./node_modules/.bin/ng e2e",
|
|
15
15
|
"generate-deps": "node generate-dependency-report.js",
|
|
16
16
|
"optimizecss": "gulp --gulpfile build-scripts/optimize-css.gulpfile.js",
|
|
17
|
-
"owasp": "
|
|
17
|
+
"owasp": "./dependency-check-bin/v13.0.0/dependency-check/bin/dependency-check.sh --project wavemaker-ng-runtime --scan . --format ALL --out ./dependency-check-reports"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"**/*",
|
|
21
21
|
".npmrc"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@angular/animations": "
|
|
25
|
-
"@angular/common": "
|
|
26
|
-
"@angular/compiler": "
|
|
27
|
-
"@angular/core": "
|
|
28
|
-
"@angular/forms": "
|
|
29
|
-
"@angular/platform-browser": "
|
|
30
|
-
"@angular/platform-browser-dynamic": "
|
|
31
|
-
"@angular/router": "
|
|
32
|
-
"@angular/service-worker": "
|
|
24
|
+
"@angular/animations": "22.2.1",
|
|
25
|
+
"@angular/common": "22.2.1",
|
|
26
|
+
"@angular/compiler": "22.2.1",
|
|
27
|
+
"@angular/core": "22.2.1",
|
|
28
|
+
"@angular/forms": "22.2.1",
|
|
29
|
+
"@angular/platform-browser": "22.2.1",
|
|
30
|
+
"@angular/platform-browser-dynamic": "22.2.1",
|
|
31
|
+
"@angular/router": "22.2.1",
|
|
32
|
+
"@angular/service-worker": "22.2.1",
|
|
33
33
|
"@fullcalendar/core": "6.1.18",
|
|
34
34
|
"@fullcalendar/daygrid": "6.1.18",
|
|
35
35
|
"@fullcalendar/interaction": "6.1.18",
|
|
36
36
|
"@fullcalendar/list": "6.1.18",
|
|
37
37
|
"@fullcalendar/timegrid": "6.1.18",
|
|
38
38
|
"@metrichor/jmespath": "0.3.1",
|
|
39
|
-
"@wavemaker-ai/custom-widgets-m3": "12.0
|
|
40
|
-
"@wavemaker-ai/foundation-css": "12.0
|
|
41
|
-
"@wavemaker-ai/variables": "12.0
|
|
39
|
+
"@wavemaker-ai/custom-widgets-m3": "12.1.0-rc.647821",
|
|
40
|
+
"@wavemaker-ai/foundation-css": "12.1.0-rc.647821",
|
|
41
|
+
"@wavemaker-ai/variables": "12.1.0-rc.647821",
|
|
42
42
|
"@wavemaker/focus-trap": "1.0.1",
|
|
43
43
|
"@wavemaker/nvd3": "1.8.16",
|
|
44
44
|
"@ztree/ztree_v3": "3.5.48",
|
|
@@ -51,32 +51,32 @@
|
|
|
51
51
|
"jquery-ui": "1.14.1",
|
|
52
52
|
"jssha": "3.3.1",
|
|
53
53
|
"lodash-es": "4.18.1",
|
|
54
|
-
"moment": "2.
|
|
54
|
+
"moment": "2.31.0",
|
|
55
55
|
"moment-timezone": "0.6.0",
|
|
56
56
|
"ng-circle-progress": "1.7.1",
|
|
57
|
-
"ngx-bootstrap": "
|
|
57
|
+
"ngx-bootstrap": "22.0.0",
|
|
58
58
|
"ngx-color-picker": "20.1.1",
|
|
59
59
|
"ngx-toastr": "20.0.5",
|
|
60
60
|
"rxjs": "7.8.2",
|
|
61
61
|
"summernote": "0.9.1",
|
|
62
62
|
"tslib": "2.8.1",
|
|
63
63
|
"x2js": "3.4.4",
|
|
64
|
-
"zone.js": "0.16.
|
|
65
|
-
"@wavemaker-ai/app-ng-runtime": "12.0
|
|
64
|
+
"zone.js": "0.16.3",
|
|
65
|
+
"@wavemaker-ai/app-ng-runtime": "12.1.0-rc.647821"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@ampproject/rollup-plugin-closure-compiler": "0.27.0",
|
|
69
|
-
"@angular-builders/custom-webpack": "
|
|
70
|
-
"@angular-devkit/build-angular": "
|
|
71
|
-
"@angular-eslint/builder": "
|
|
72
|
-
"@angular-eslint/eslint-plugin": "
|
|
73
|
-
"@angular-eslint/eslint-plugin-template": "
|
|
74
|
-
"@angular-eslint/schematics": "
|
|
75
|
-
"@angular-eslint/template-parser": "
|
|
76
|
-
"@angular/cli": "
|
|
77
|
-
"@angular/compiler-cli": "
|
|
78
|
-
"@angular/language-service": "
|
|
79
|
-
"@compodoc/compodoc": "
|
|
69
|
+
"@angular-builders/custom-webpack": "22.0.1",
|
|
70
|
+
"@angular-devkit/build-angular": "22.2.1",
|
|
71
|
+
"@angular-eslint/builder": "22.5.0",
|
|
72
|
+
"@angular-eslint/eslint-plugin": "22.5.0",
|
|
73
|
+
"@angular-eslint/eslint-plugin-template": "22.5.0",
|
|
74
|
+
"@angular-eslint/schematics": "22.5.0",
|
|
75
|
+
"@angular-eslint/template-parser": "22.5.0",
|
|
76
|
+
"@angular/cli": "22.2.1",
|
|
77
|
+
"@angular/compiler-cli": "22.2.1",
|
|
78
|
+
"@angular/language-service": "22.2.1",
|
|
79
|
+
"@compodoc/compodoc": "2.0.0",
|
|
80
80
|
"@rollup/plugin-alias": "5.1.1",
|
|
81
81
|
"@rollup/plugin-commonjs": "28.0.6",
|
|
82
82
|
"@rollup/plugin-multi-entry": "6.0.1",
|
|
@@ -86,27 +86,26 @@
|
|
|
86
86
|
"@types/jquery": "3.5.32",
|
|
87
87
|
"@types/lodash-es": "4.17.12",
|
|
88
88
|
"@types/node": "24.2.0",
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
90
|
-
"@typescript-eslint/parser": "8.
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "8.71.0",
|
|
90
|
+
"@typescript-eslint/parser": "8.71.0",
|
|
91
91
|
"cheerio": "1.1.2",
|
|
92
92
|
"compression-webpack-plugin": "12.0.0",
|
|
93
93
|
"core-js": "3.45.0",
|
|
94
94
|
"eslint": "8.45.0",
|
|
95
95
|
"fs": "0.0.1-security",
|
|
96
96
|
"fs-extra": "11.3.1",
|
|
97
|
-
"jest": "30.
|
|
97
|
+
"jest": "30.5.2",
|
|
98
98
|
"jest-canvas-mock": "2.5.2",
|
|
99
|
-
"jest-environment-jsdom": "30.
|
|
100
|
-
"jest-preset-angular": "
|
|
99
|
+
"jest-environment-jsdom": "30.5.2",
|
|
100
|
+
"jest-preset-angular": "17.0.0",
|
|
101
101
|
"license-checker": "25.0.1",
|
|
102
102
|
"moment-locales-webpack-plugin": "1.2.0",
|
|
103
|
-
"ng-packagr": "
|
|
104
|
-
"owasp-dependency-check": "1.0.1",
|
|
103
|
+
"ng-packagr": "22.2.4",
|
|
105
104
|
"rimraf": "6.0.1",
|
|
106
105
|
"rollup": "4.60.1",
|
|
107
|
-
"sonarqube-scanner": "5.0
|
|
106
|
+
"sonarqube-scanner": "3.5.0",
|
|
108
107
|
"terser": "5.43.1",
|
|
109
|
-
"typescript": "
|
|
108
|
+
"typescript": "6.0.3",
|
|
110
109
|
"util": "0.12.5",
|
|
111
110
|
"yargs": "18.0.0"
|
|
112
111
|
},
|
|
@@ -117,31 +116,28 @@
|
|
|
117
116
|
"@rollup/rollup-win32-x64": "4.60.1"
|
|
118
117
|
},
|
|
119
118
|
"engines": {
|
|
120
|
-
"node": "22.
|
|
121
|
-
"npm": "10.9.
|
|
119
|
+
"node": "22.22.3",
|
|
120
|
+
"npm": "10.9.8"
|
|
122
121
|
},
|
|
123
122
|
"overrides": {
|
|
124
123
|
"@babel/core": "7.29.7",
|
|
125
124
|
"adm-zip": "0.6.1",
|
|
126
|
-
"@compodoc/compodoc": {
|
|
127
|
-
"@angular-devkit/core": {
|
|
128
|
-
"ajv": "8.18.0"
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
125
|
"esbuild": "0.28.2",
|
|
132
126
|
"http-proxy-middleware": "3.0.7",
|
|
133
127
|
"less": "4.9.0",
|
|
134
128
|
"magic-string": "0.30.21",
|
|
135
129
|
"picomatch": "4.0.4",
|
|
136
|
-
"piscina": "5.2
|
|
130
|
+
"piscina": "5.3.2",
|
|
137
131
|
"postcss": "8.5.26",
|
|
138
132
|
"rollup": "4.60.1",
|
|
139
|
-
"
|
|
133
|
+
"serialize-javascript": "7.1.2",
|
|
134
|
+
"undici": "7.30.0",
|
|
140
135
|
"uuid": "14.0.0",
|
|
141
136
|
"vite": {
|
|
142
137
|
".": "7.3.6",
|
|
143
138
|
"esbuild": "0.28.2"
|
|
144
139
|
},
|
|
140
|
+
"webpack-dev-middleware": "8.3.0",
|
|
145
141
|
"webpack-dev-server": "5.2.6"
|
|
146
142
|
},
|
|
147
143
|
"engineStrict": true
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { routes } from './app.routes';
|
|
2
|
+
import { initScript } from './app.component.script';
|
|
3
|
+
import { variables } from './app.component.variables';
|
|
4
|
+
import initWmProjectProperties from './wm-project-properties';
|
|
5
|
+
import { WMAppProperties } from './wmProperties';
|
|
6
|
+
import { LazyLoadScriptsResolve } from './lazy-load-scripts.resolve';
|
|
7
|
+
import { environment as devEnvironment } from '../environments/environment.dev';
|
|
8
|
+
import { environment as prodEnvironment } from '../environments/environment.prod';
|
|
9
|
+
import { environment } from '../environments/environment';
|
|
10
|
+
|
|
11
|
+
describe('generated app placeholders', () => {
|
|
12
|
+
it('start out empty until code generation fills them in', () => {
|
|
13
|
+
expect(routes).toEqual([]);
|
|
14
|
+
expect(variables).toEqual({});
|
|
15
|
+
expect(initScript(null, null, null)).toBeUndefined();
|
|
16
|
+
expect(initWmProjectProperties()).toBeUndefined();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('exposes sensible default app properties', () => {
|
|
20
|
+
expect(WMAppProperties).toEqual(expect.objectContaining({
|
|
21
|
+
name: 'wavemaker-ng-runtime',
|
|
22
|
+
type: 'APPLICATION',
|
|
23
|
+
platformType: 'WEB',
|
|
24
|
+
languageBundleSources: 'STATIC',
|
|
25
|
+
preferredLanguage: 'en'
|
|
26
|
+
}));
|
|
27
|
+
expect(WMAppProperties.supportedLanguages).toEqual({ en: { moment: 'en' } });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('LazyLoadScriptsResolve resolves without doing anything', async () => {
|
|
31
|
+
await expect(new LazyLoadScriptsResolve({} as any).resolve()).resolves.toBeUndefined();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('defines environments for development and production', () => {
|
|
35
|
+
expect(environment.production).toBe(false);
|
|
36
|
+
expect(devEnvironment.production).toBe(false);
|
|
37
|
+
expect(prodEnvironment.production).toBe(true);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
jest.mock('@wm/runtime/base', () => ({
|
|
2
|
+
ComponentRefProvider: class ComponentRefProvider {},
|
|
3
|
+
ComponentType: { PAGE: 'PAGE', PARTIAL: 'PARTIAL', PREFAB: 'PREFAB', WIDGET: 'WIDGET' }
|
|
4
|
+
}));
|
|
5
|
+
jest.mock('@wm/core', () => ({
|
|
6
|
+
...jest.requireActual('@wm/core'),
|
|
7
|
+
PartialRefProvider: class PartialRefProvider {}
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
import { ComponentType } from '@wm/runtime/base';
|
|
11
|
+
import { partialLazyModules, prefabLazyModules, prefabPartialLazyModules } from '../util/lazy-module-routes';
|
|
12
|
+
import { ComponentRefProviderService } from './component-ref-provider.service';
|
|
13
|
+
import { LazyComponentRefProviderService } from './lazy-component-ref-provider.service';
|
|
14
|
+
|
|
15
|
+
class Cmp {}
|
|
16
|
+
|
|
17
|
+
describe('LazyComponentRefProviderService', () => {
|
|
18
|
+
let service: LazyComponentRefProviderService;
|
|
19
|
+
let errorSpy: jest.SpyInstance;
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
service = new LazyComponentRefProviderService();
|
|
23
|
+
errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
[partialLazyModules, prefabLazyModules, prefabPartialLazyModules].forEach(m => Object.keys(m).forEach(k => delete m[k]));
|
|
28
|
+
jest.restoreAllMocks();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('loads standard partials, prefabs and prefab scoped partials', async () => {
|
|
32
|
+
partialLazyModules['P'] = { loadComponent: () => Promise.resolve(Cmp) };
|
|
33
|
+
prefabLazyModules['Pf'] = { loadComponent: () => Promise.resolve(Cmp) };
|
|
34
|
+
prefabPartialLazyModules['Pf_P'] = { loadComponent: () => Promise.resolve(Cmp) };
|
|
35
|
+
await expect(service.getComponentFactoryRef('P', ComponentType.PARTIAL)).resolves.toBe(Cmp);
|
|
36
|
+
await expect(service.getComponentFactoryRef('Pf', ComponentType.PREFAB)).resolves.toBe(Cmp);
|
|
37
|
+
await expect(service.getComponentFactoryRef('P', ComponentType.PARTIAL, { prefab: 'Pf' })).resolves.toBe(Cmp);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('returns null and logs when no lazy module exists', async () => {
|
|
41
|
+
await expect(service.getComponentFactoryRef('X', ComponentType.PARTIAL)).resolves.toBeNull();
|
|
42
|
+
await expect(service.getComponentFactoryRef('X', ComponentType.PAGE)).resolves.toBeNull();
|
|
43
|
+
expect(errorSpy).toHaveBeenCalledWith('No lazy module found for X');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('returns null when the module resolves no component or throws', async () => {
|
|
47
|
+
partialLazyModules['Empty'] = { loadComponent: () => Promise.resolve(undefined as any) };
|
|
48
|
+
partialLazyModules['Boom'] = { loadComponent: () => Promise.reject(new Error('x')) };
|
|
49
|
+
await expect(service.getComponentFactoryRef('Empty', ComponentType.PARTIAL)).resolves.toBeNull();
|
|
50
|
+
expect(errorSpy).toHaveBeenCalledWith('Failed to load component class: Empty');
|
|
51
|
+
await expect(service.getComponentFactoryRef('Boom', ComponentType.PARTIAL)).resolves.toBeNull();
|
|
52
|
+
expect(errorSpy).toHaveBeenCalledWith('Error lazy loading component Boom:', expect.any(Error));
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('ComponentRefProviderService', () => {
|
|
57
|
+
let lazy: any;
|
|
58
|
+
let service: ComponentRefProviderService;
|
|
59
|
+
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
lazy = { getComponentFactoryRef: jest.fn(() => Promise.resolve(null)) };
|
|
62
|
+
service = new ComponentRefProviderService(lazy);
|
|
63
|
+
jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
afterEach(() => jest.restoreAllMocks());
|
|
67
|
+
|
|
68
|
+
it('returns registered components from the cache', async () => {
|
|
69
|
+
ComponentRefProviderService.registerComponentRef('Home', ComponentType.PAGE, Cmp, { legacy: true });
|
|
70
|
+
await expect(service.getComponentFactoryRef('Home', ComponentType.PAGE)).resolves.toBe(Cmp);
|
|
71
|
+
expect(lazy.getComponentFactoryRef).not.toHaveBeenCalled();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('falls back to lazy loading for partials and prefabs', async () => {
|
|
75
|
+
class Lazy {}
|
|
76
|
+
lazy.getComponentFactoryRef.mockResolvedValueOnce(Lazy);
|
|
77
|
+
await expect(service.getComponentFactoryRef('LazyP', ComponentType.PARTIAL, { prefab: 'x' })).resolves.toBe(Lazy);
|
|
78
|
+
expect(lazy.getComponentFactoryRef).toHaveBeenCalledWith('LazyP', ComponentType.PARTIAL, { prefab: 'x' });
|
|
79
|
+
lazy.getComponentFactoryRef.mockResolvedValueOnce(Lazy);
|
|
80
|
+
await expect(service.getComponentFactoryRef('LazyPf', ComponentType.PREFAB)).resolves.toBe(Lazy);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('warns and returns null when nothing is found', async () => {
|
|
84
|
+
await expect(service.getComponentFactoryRef('Nope', ComponentType.PARTIAL)).resolves.toBeNull();
|
|
85
|
+
await expect(service.getComponentFactoryRef('Nope', ComponentType.PAGE)).resolves.toBeNull();
|
|
86
|
+
expect(lazy.getComponentFactoryRef).toHaveBeenCalledTimes(1);
|
|
87
|
+
expect(console.warn).toHaveBeenCalledWith('Component not found: Nope (type: PAGE)');
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('treats unknown component types as not found', async () => {
|
|
91
|
+
await expect(service.getComponentFactoryRef('x', 'OTHER' as any)).resolves.toBeNull();
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
jest.mock('@wm/runtime/base', () => ({
|
|
2
|
+
AppExtensionProvider: class AppExtensionProvider {},
|
|
3
|
+
AppJSProvider: class AppJSProvider {},
|
|
4
|
+
AppVariablesProvider: class AppVariablesProvider {},
|
|
5
|
+
PrefabConfigProvider: class PrefabConfigProvider {},
|
|
6
|
+
CustomwidgetConfigProvider: class CustomwidgetConfigProvider {}
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
import { registerCustomWidgetConfig, registerPrefabConfig } from '../util/page-util';
|
|
10
|
+
import { AppExtensionProviderService } from './app-extension.service';
|
|
11
|
+
import { AppJSProviderService } from './app-js-provider.service';
|
|
12
|
+
import { AppVariablesProviderService } from './app-variables-provider.service';
|
|
13
|
+
import { CustomwidgetConfigProviderService } from './customwidget-config-provider.service';
|
|
14
|
+
import { PrefabConfigProviderService } from './prefab-config-provider.service';
|
|
15
|
+
import { initScript } from '../../app/app.component.script';
|
|
16
|
+
import { variables } from '../../app/app.component.variables';
|
|
17
|
+
|
|
18
|
+
describe('framework providers', () => {
|
|
19
|
+
describe('AppExtensionProviderService', () => {
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
delete (global as any).WM_CUSTOM_FORMATTERS;
|
|
22
|
+
jest.restoreAllMocks();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('passes the generated custom formatters to the callback', () => {
|
|
26
|
+
(global as any).WM_CUSTOM_FORMATTERS = { f: 1 };
|
|
27
|
+
const cb = jest.fn();
|
|
28
|
+
new AppExtensionProviderService().loadFormatterConfigScript(cb);
|
|
29
|
+
expect(cb).toHaveBeenCalledWith({ f: 1 });
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('warns when the formatters are not available', () => {
|
|
33
|
+
const warn = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
34
|
+
const cb = jest.fn();
|
|
35
|
+
new AppExtensionProviderService().loadFormatterConfigScript(cb);
|
|
36
|
+
expect(cb).not.toHaveBeenCalled();
|
|
37
|
+
expect(warn).toHaveBeenCalledWith('Error while loading the formatters.js file');
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('AppJSProviderService returns the generated app script function', async () => {
|
|
42
|
+
await expect(new AppJSProviderService().getAppScriptFn()).resolves.toBe(initScript);
|
|
43
|
+
expect(initScript({}, {}, {})).toBeUndefined();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('AppVariablesProviderService returns the generated app variables', async () => {
|
|
47
|
+
await expect(new AppVariablesProviderService().getAppVariables()).resolves.toBe(variables);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('PrefabConfigProviderService resolves registered prefab configs', async () => {
|
|
51
|
+
registerPrefabConfig('providerPf', { c: 1 });
|
|
52
|
+
const service = new PrefabConfigProviderService();
|
|
53
|
+
await expect(service.getConfig('providerPf')).resolves.toEqual({ c: 1 });
|
|
54
|
+
await expect(service.getConfig('missing')).resolves.toBeUndefined();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('CustomwidgetConfigProviderService resolves registered widget configs', async () => {
|
|
58
|
+
registerCustomWidgetConfig('providerW', { d: 1 });
|
|
59
|
+
const service = new CustomwidgetConfigProviderService();
|
|
60
|
+
await expect(service.getConfig('providerW')).resolves.toEqual({ d: 1 });
|
|
61
|
+
await expect(service.getConfig('missing')).resolves.toBeUndefined();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { partialLazyModules, prefabLazyModules, prefabPartialLazyModules } from './lazy-module-routes';
|
|
2
|
+
|
|
3
|
+
describe('lazy-module-routes', () => {
|
|
4
|
+
it('starts with empty registries that code generation fills in', () => {
|
|
5
|
+
expect(prefabLazyModules).toEqual({});
|
|
6
|
+
expect(partialLazyModules).toEqual({});
|
|
7
|
+
expect(prefabPartialLazyModules).toEqual({});
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getCustomWidgetConfig, getPrefabConfig, registerCustomWidgetConfig, registerPrefabConfig } from './page-util';
|
|
2
|
+
|
|
3
|
+
describe('page-util', () => {
|
|
4
|
+
it('registers and returns prefab configs', () => {
|
|
5
|
+
expect(getPrefabConfig('pf')).toBeUndefined();
|
|
6
|
+
registerPrefabConfig('pf', { a: 1 });
|
|
7
|
+
expect(getPrefabConfig('pf')).toEqual({ a: 1 });
|
|
8
|
+
registerPrefabConfig('pf', { a: 2 });
|
|
9
|
+
expect(getPrefabConfig('pf')).toEqual({ a: 2 });
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('registers and returns custom widget configs independently of prefab configs', () => {
|
|
13
|
+
expect(getCustomWidgetConfig('w')).toBeUndefined();
|
|
14
|
+
registerCustomWidgetConfig('w', { b: 1 });
|
|
15
|
+
expect(getCustomWidgetConfig('w')).toEqual({ b: 1 });
|
|
16
|
+
expect(getPrefabConfig('w')).toBeUndefined();
|
|
17
|
+
});
|
|
18
|
+
});
|
package/src/setup-jest.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
// This file is automatically loaded when running `jest` commands
|
|
2
|
+
// This file is automatically loaded when running `jest` commands.
|
|
3
|
+
// ngx-bootstrap ESM patching (build-scripts/ngx-bootstrap-patch.mjs) is a build-time
|
|
4
|
+
// concern (applied via its Rollup plugin during build.sh) -- deliberately not called
|
|
5
|
+
// here or anywhere else in the test flow.
|
|
3
6
|
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
|
|
4
7
|
import { ToastrModule } from 'ngx-toastr';
|
|
5
8
|
import { TestBed } from '@angular/core/testing';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
describe('wm-namespace', () => {
|
|
2
|
+
const original = process.env.WM_NPM_SCOPE;
|
|
3
|
+
|
|
4
|
+
const load = () => {
|
|
5
|
+
let mod: any;
|
|
6
|
+
jest.isolateModules(() => {
|
|
7
|
+
mod = require('./wm-namespace');
|
|
8
|
+
});
|
|
9
|
+
return mod;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
if (original === undefined) {
|
|
14
|
+
delete process.env.WM_NPM_SCOPE;
|
|
15
|
+
} else {
|
|
16
|
+
process.env.WM_NPM_SCOPE = original;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('defaults to the @wavemaker-ai scope', () => {
|
|
21
|
+
delete process.env.WM_NPM_SCOPE;
|
|
22
|
+
expect(load().WM_NPM_SCOPE).toBe('@wavemaker-ai');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('can be overridden through the WM_NPM_SCOPE environment variable', () => {
|
|
26
|
+
process.env.WM_NPM_SCOPE = '@wavemaker';
|
|
27
|
+
expect(load().WM_NPM_SCOPE).toBe('@wavemaker');
|
|
28
|
+
});
|
|
29
|
+
});
|
package/tsconfig.json
CHANGED