newportsite 1.1.3
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/newportsite-1.1.3.tgz +0 -0
- package/ng-package.json +7 -0
- package/obfuscate.js +70 -0
- package/package.json +15 -0
- package/src/lib/app.component.ts +47 -0
- package/src/lib/app.routing.ts +38 -0
- package/src/lib/auth/alert.component.html +5 -0
- package/src/lib/auth/alert.component.ts +24 -0
- package/src/lib/auth/auth.component.html +1 -0
- package/src/lib/auth/auth.component.ts +10 -0
- package/src/lib/auth/auth.routes.ts +16 -0
- package/src/lib/auth/index.ts +4 -0
- package/src/lib/auth/login.component.html +87 -0
- package/src/lib/auth/login.component.ts +158 -0
- package/src/lib/auth/models/index.ts +1 -0
- package/src/lib/auth/models/user.ts +25 -0
- package/src/lib/auth/register.component.html +157 -0
- package/src/lib/auth/register.component.ts +219 -0
- package/src/lib/auth/services/alert.service.ts +47 -0
- package/src/lib/auth/services/auth.service.ts +28 -0
- package/src/lib/auth/services/index.ts +3 -0
- package/src/lib/auth/services/user.service.spec.ts +112 -0
- package/src/lib/auth/services/user.service.ts +47 -0
- package/src/lib/common/card.component.html +72 -0
- package/src/lib/common/card.component.ts +102 -0
- package/src/lib/common/commands.component.html +8 -0
- package/src/lib/common/commands.component.ts +42 -0
- package/src/lib/common/context.component.html +9 -0
- package/src/lib/common/context.component.ts +38 -0
- package/src/lib/common/grid.component.html +20 -0
- package/src/lib/common/grid.component.ts +747 -0
- package/src/lib/common/index.ts +9 -0
- package/src/lib/common/loader.component.html +5 -0
- package/src/lib/common/loader.component.ts +27 -0
- package/src/lib/common/lookup.component.html +29 -0
- package/src/lib/common/lookup.component.ts +115 -0
- package/src/lib/common/messagebox.component.html +39 -0
- package/src/lib/common/messagebox.component.ts +74 -0
- package/src/lib/common/theme-toggle.component.ts +139 -0
- package/src/lib/config.ts +62 -0
- package/src/lib/containers/default-layout/default-layout.component.html +191 -0
- package/src/lib/containers/default-layout/default-layout.component.ts +158 -0
- package/src/lib/containers/default-layout/index.ts +1 -0
- package/src/lib/containers/index.ts +1 -0
- package/src/lib/directives/component.draggable.ts +80 -0
- package/src/lib/directives/index.ts +2 -0
- package/src/lib/directives/input.directive.spec.ts +158 -0
- package/src/lib/directives/input.directive.ts +210 -0
- package/src/lib/home/dashboard/dashboard.component.html +38 -0
- package/src/lib/home/dashboard/dashboard.component.ts +50 -0
- package/src/lib/home/dashboard/index.ts +1 -0
- package/src/lib/home/index.component.html +1 -0
- package/src/lib/home/index.component.ts +10 -0
- package/src/lib/home/index.routes.ts +29 -0
- package/src/lib/home/index.ts +1 -0
- package/src/lib/home/info/index.ts +1 -0
- package/src/lib/home/info/info.component.css +476 -0
- package/src/lib/home/info/info.component.html +174 -0
- package/src/lib/home/info/info.component.ts +287 -0
- package/src/lib/home/model/article.component.html +10 -0
- package/src/lib/home/model/article.component.ts +50 -0
- package/src/lib/home/model/barchart.component.html +8 -0
- package/src/lib/home/model/barchart.component.ts +59 -0
- package/src/lib/home/model/index.ts +7 -0
- package/src/lib/home/model/itemdetail.component.html +25 -0
- package/src/lib/home/model/itemdetail.component.ts +93 -0
- package/src/lib/home/model/itemtab.component.html +25 -0
- package/src/lib/home/model/itemtab.component.ts +105 -0
- package/src/lib/home/model/model.component.html +121 -0
- package/src/lib/home/model/model.component.ts +510 -0
- package/src/lib/home/model/modeltoolbar.component.html +111 -0
- package/src/lib/home/model/modeltoolbar.component.ts +157 -0
- package/src/lib/home/model/navigation.component.html +86 -0
- package/src/lib/home/model/navigation.component.ts +247 -0
- package/src/lib/home/model/services/index.ts +1 -0
- package/src/lib/home/model/services/model.service.spec.ts +423 -0
- package/src/lib/home/model/services/model.service.ts +319 -0
- package/src/lib/home/modelsearch/index.ts +1 -0
- package/src/lib/home/modelsearch/modelsearch.component.html +124 -0
- package/src/lib/home/modelsearch/modelsearch.component.ts +453 -0
- package/src/lib/interfaces/data.interface.ts +131 -0
- package/src/lib/interfaces/index.ts +2 -0
- package/src/lib/interfaces/item.interface.ts +438 -0
- package/src/lib/players/lookup/lookup.directive.ts +6 -0
- package/src/lib/players/lookup/lookup.item.component.ts +37 -0
- package/src/lib/players/lookup/lookup.item.ts +9 -0
- package/src/lib/players/lookup/lookup.player.component.ts +59 -0
- package/src/lib/players/lookup/lookup.selector.component.ts +41 -0
- package/src/lib/players/model/model.directive.ts +6 -0
- package/src/lib/players/model/model.item.component.spec.ts +311 -0
- package/src/lib/players/model/model.item.component.ts +3457 -0
- package/src/lib/players/model/model.item.ts +9 -0
- package/src/lib/players/model/model.player.component.ts +109 -0
- package/src/lib/players/model/model.selector.component.ts +59 -0
- package/src/lib/scheduler/scheduler.component.html +13 -0
- package/src/lib/scheduler/scheduler.component.scss +6 -0
- package/src/lib/scheduler/scheduler.component.ts +296 -0
- package/src/lib/scheduler/scheduler.routes.ts +15 -0
- package/src/lib/scheduler/schedulerdialog.component.html +72 -0
- package/src/lib/scheduler/schedulerdialog.component.ts +208 -0
- package/src/lib/scheduler/services/scheduler.service.ts +133 -0
- package/src/lib/services/auth-state.service.ts +129 -0
- package/src/lib/services/auth.interceptor.spec.ts +144 -0
- package/src/lib/services/auth.interceptor.ts +44 -0
- package/src/lib/services/cache.service.spec.ts +143 -0
- package/src/lib/services/cache.service.ts +71 -0
- package/src/lib/services/global-error-handler.spec.ts +39 -0
- package/src/lib/services/global-error-handler.ts +28 -0
- package/src/lib/services/global.service.spec.ts +801 -0
- package/src/lib/services/global.service.ts +724 -0
- package/src/lib/services/message.service.ts +556 -0
- package/src/lib/services/theme.service.ts +96 -0
- package/src/lib/template/authtemplate.component.html +6 -0
- package/src/lib/template/authtemplate.component.ts +13 -0
- package/src/lib/template/basetemplate.component.html +7 -0
- package/src/lib/template/basetemplate.component.ts +13 -0
- package/src/lib/template/index.ts +3 -0
- package/src/lib/template/modeltemplate.component.html +7 -0
- package/src/lib/template/modeltemplate.component.ts +21 -0
- package/src/lib/utils/piva.spec.ts +56 -0
- package/src/lib/utils/piva.ts +29 -0
- package/src/lib/validators/email.validator.spec.ts +57 -0
- package/src/lib/validators/email.validator.ts +17 -0
- package/src/lib/validators/equalPasswords.validator.spec.ts +54 -0
- package/src/lib/validators/equalPasswords.validator.ts +17 -0
- package/src/lib/validators/index.ts +2 -0
- package/src/lib/version.ts +1 -0
- package/src/public-api.ts +64 -0
- package/src/typings.d.ts +2 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +9 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
|
2
|
+
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
import { Location } from '@angular/common';
|
|
5
|
+
import { NEVER } from 'rxjs';
|
|
6
|
+
import { ModelItemComponent } from './model.item.component';
|
|
7
|
+
import { GlobalService } from '../../services/global.service';
|
|
8
|
+
import { AppMessageService } from '../../services/message.service';
|
|
9
|
+
import { ManagmentService } from '../../home/model/services/index';
|
|
10
|
+
import { ManagmentInterface, Member } from '../../interfaces/index';
|
|
11
|
+
import { ModuleData } from '../../interfaces/data.interface';
|
|
12
|
+
import { NEWPORT_CONFIG } from '../../config';
|
|
13
|
+
|
|
14
|
+
// ── Stubs ────────────────────────────────────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
/** Minimal GlobalService stub: covers only what the constructor and tested methods call. */
|
|
17
|
+
function makeGsvStub() {
|
|
18
|
+
return {
|
|
19
|
+
getManagmentInterface: (): ManagmentInterface => ({
|
|
20
|
+
functionId: '',
|
|
21
|
+
appId: '',
|
|
22
|
+
entId: '',
|
|
23
|
+
year: 0,
|
|
24
|
+
keys: '',
|
|
25
|
+
fields: [],
|
|
26
|
+
states: [],
|
|
27
|
+
entIds: [],
|
|
28
|
+
keyId: '1',
|
|
29
|
+
filterId: '',
|
|
30
|
+
page: 1,
|
|
31
|
+
data: '',
|
|
32
|
+
}),
|
|
33
|
+
getFieldChanged: () => NEVER,
|
|
34
|
+
getCurrentField: () => NEVER,
|
|
35
|
+
getProject: () => ({ project: 'PROJ', year: 2024, type: 'M' }),
|
|
36
|
+
setDialog: jest.fn(),
|
|
37
|
+
getDialog: () => ({ target: '', state: false }),
|
|
38
|
+
setCurrentFocus: jest.fn(),
|
|
39
|
+
getCurrentFocus: () => ({ id: '', value: '' }),
|
|
40
|
+
setLoaderState: jest.fn(),
|
|
41
|
+
emitGridRefresh: jest.fn(),
|
|
42
|
+
setItemCommands: jest.fn(),
|
|
43
|
+
setLookupField: jest.fn(),
|
|
44
|
+
setDialogField: jest.fn(),
|
|
45
|
+
setData: jest.fn(),
|
|
46
|
+
getData: jest.fn(),
|
|
47
|
+
setExtendedDescription: jest.fn(),
|
|
48
|
+
navigate: jest.fn(),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const msgStub = { get: (id: string) => id };
|
|
53
|
+
const msvStub = { getData: jest.fn() };
|
|
54
|
+
const routerStub = { navigateByUrl: jest.fn().mockResolvedValue(true) };
|
|
55
|
+
const locationStub = { normalize: (url: string) => url };
|
|
56
|
+
|
|
57
|
+
// ── Setup helper ─────────────────────────────────────────────────────────────
|
|
58
|
+
|
|
59
|
+
let fixture: ComponentFixture<ModelItemComponent>;
|
|
60
|
+
let component: ModelItemComponent;
|
|
61
|
+
let gsvStub: ReturnType<typeof makeGsvStub>;
|
|
62
|
+
|
|
63
|
+
function createComponent() {
|
|
64
|
+
gsvStub = makeGsvStub();
|
|
65
|
+
|
|
66
|
+
TestBed.configureTestingModule({
|
|
67
|
+
imports: [ModelItemComponent],
|
|
68
|
+
providers: [
|
|
69
|
+
{ provide: GlobalService, useValue: gsvStub },
|
|
70
|
+
{ provide: AppMessageService, useValue: msgStub },
|
|
71
|
+
{ provide: ManagmentService, useValue: msvStub },
|
|
72
|
+
{ provide: Router, useValue: routerStub },
|
|
73
|
+
{ provide: Location, useValue: locationStub },
|
|
74
|
+
{ provide: NEWPORT_CONFIG, useValue: { apiUrl: 'http://test/', logicFactory: () => {}, projectsInfoLoader: () => Promise.resolve({}) } },
|
|
75
|
+
],
|
|
76
|
+
schemas: [NO_ERRORS_SCHEMA],
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
fixture = TestBed.createComponent(ModelItemComponent);
|
|
80
|
+
component = fixture.componentInstance;
|
|
81
|
+
// Do NOT call fixture.detectChanges() — avoids ngAfterViewInit's async getData call.
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ── Test suite ───────────────────────────────────────────────────────────────
|
|
85
|
+
|
|
86
|
+
describe('ModelItemComponent — pure utility methods', () => {
|
|
87
|
+
beforeEach(() => {
|
|
88
|
+
jest.clearAllMocks();
|
|
89
|
+
createComponent();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// ── getKeyArray ───────────────────────────────────────────────────────────
|
|
93
|
+
|
|
94
|
+
describe('getKeyArray()', () => {
|
|
95
|
+
it('parses a single-segment key into [n]', () => {
|
|
96
|
+
component.managment.keys = 'prg=5';
|
|
97
|
+
expect(component.getKeyArray()).toEqual([5]);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('parses a multi-segment key into [a, b, c]', () => {
|
|
101
|
+
component.managment.keys = 'prg=1;prg=3;prg=7';
|
|
102
|
+
expect(component.getKeyArray()).toEqual([1, 3, 7]);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('parses the initial default key prg=1', () => {
|
|
106
|
+
component.managment.keys = 'prg=1';
|
|
107
|
+
expect(component.getKeyArray()).toEqual([1]);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// ── getLastKey ───────────────────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
describe('getLastKey()', () => {
|
|
114
|
+
it('returns the last segment value for a single key', () => {
|
|
115
|
+
component.managment.keys = 'prg=9';
|
|
116
|
+
expect(component.getLastKey()).toBe(9);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('returns the last segment for a multi-key string', () => {
|
|
120
|
+
component.managment.keys = 'prg=1;prg=2;prg=42';
|
|
121
|
+
expect(component.getLastKey()).toBe(42);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ── setLastKey ───────────────────────────────────────────────────────────
|
|
126
|
+
|
|
127
|
+
describe('setLastKey()', () => {
|
|
128
|
+
it('replaces the last segment of a single key', () => {
|
|
129
|
+
component.managment.keys = 'prg=1';
|
|
130
|
+
component.setLastKey(99);
|
|
131
|
+
expect(component.managment.keys).toBe('prg=99');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('replaces only the last segment, leaving others intact', () => {
|
|
135
|
+
component.managment.keys = 'prg=1;prg=2;prg=3';
|
|
136
|
+
component.setLastKey(77);
|
|
137
|
+
expect(component.managment.keys).toBe('prg=1;prg=2;prg=77');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('is consistent with getLastKey after set', () => {
|
|
141
|
+
component.managment.keys = 'prg=1;prg=5';
|
|
142
|
+
component.setLastKey(10);
|
|
143
|
+
expect(component.getLastKey()).toBe(10);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ── getEntIdModel ────────────────────────────────────────────────────────
|
|
148
|
+
|
|
149
|
+
describe('getEntIdModel()', () => {
|
|
150
|
+
it('builds the composite entity key APP.ENT.YEAR', () => {
|
|
151
|
+
component.managment.appId = 'APP';
|
|
152
|
+
component.managment.entId = 'ENT';
|
|
153
|
+
component.managment.year = 2024;
|
|
154
|
+
expect(component.getEntIdModel()).toBe('APP.ENT.2024');
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// ── getIdModel ───────────────────────────────────────────────────────────
|
|
159
|
+
|
|
160
|
+
describe('getIdModel()', () => {
|
|
161
|
+
it('builds the composite project key PROJECT.YEAR using gsv.getProject()', () => {
|
|
162
|
+
// gsvStub.getProject() returns { project: 'PROJ', year: 2024 }
|
|
163
|
+
expect(component.getIdModel()).toBe('PROJ.2024');
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// ── parseWidth ───────────────────────────────────────────────────────────
|
|
168
|
+
|
|
169
|
+
describe('parseWidth()', () => {
|
|
170
|
+
it('strips px suffix and returns integer', () => {
|
|
171
|
+
expect(component.parseWidth('120px')).toBe(120);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('handles plain number strings', () => {
|
|
175
|
+
expect(component.parseWidth('75')).toBe(75);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// ── trackByField ─────────────────────────────────────────────────────────
|
|
180
|
+
|
|
181
|
+
describe('trackByField()', () => {
|
|
182
|
+
it('returns the field name when it is non-empty', () => {
|
|
183
|
+
const field = { name: 'CODICE' } as Member;
|
|
184
|
+
expect(component.trackByField(0, field)).toBe('CODICE');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('falls back to index string when name is empty', () => {
|
|
188
|
+
const field = { name: '' } as Member;
|
|
189
|
+
expect(component.trackByField(5, field)).toBe('5');
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// ── trackByCombo ─────────────────────────────────────────────────────────
|
|
194
|
+
|
|
195
|
+
describe('trackByCombo()', () => {
|
|
196
|
+
it('returns the item string when non-empty', () => {
|
|
197
|
+
expect(component.trackByCombo(0, 'IT')).toBe('IT');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('falls back to index string when item is empty', () => {
|
|
201
|
+
expect(component.trackByCombo(3, '')).toBe('3');
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// ── getLastKeyFromModule ──────────────────────────────────────────────────
|
|
206
|
+
|
|
207
|
+
describe('getLastKeyFromModule()', () => {
|
|
208
|
+
function makeModule(prg: number[]): ModuleData {
|
|
209
|
+
return { prg, state: 1, members: [] };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
it('returns modulefiltered.length when only one record exists', () => {
|
|
213
|
+
const modules: ModuleData[] = [makeModule([1])];
|
|
214
|
+
const result = component.getLastKeyFromModule(modules, 0);
|
|
215
|
+
// lastKey = 0, startKey = modules.length = 1
|
|
216
|
+
expect(result).toBe(1);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('returns prg[prgLength] + 1 for the second-to-last record when multiple exist', () => {
|
|
220
|
+
// modules[0].prg[0] = 1, modules[1].prg[0] = 5
|
|
221
|
+
const modules: ModuleData[] = [makeModule([1]), makeModule([5])];
|
|
222
|
+
const result = component.getLastKeyFromModule(modules, 0);
|
|
223
|
+
// lastKey = 1, startKey = modules[0].prg[0] + 1 = 2
|
|
224
|
+
expect(result).toBe(2);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
it('mutates this.lastKey to modulefiltered.length - 1', () => {
|
|
228
|
+
const modules: ModuleData[] = [makeModule([1]), makeModule([5]), makeModule([9])];
|
|
229
|
+
component.getLastKeyFromModule(modules, 0);
|
|
230
|
+
expect(component.lastKey).toBe(2);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// ── LIFO intodetail sort logic ────────────────────────────────────────────────
|
|
236
|
+
|
|
237
|
+
describe('intodetail LIFO localStorage sort', () => {
|
|
238
|
+
/**
|
|
239
|
+
* White-box test: verifies the sort logic that was added to sendCommand exit branch.
|
|
240
|
+
* We replicate the key-extraction/sort in isolation to avoid triggering the full
|
|
241
|
+
* command flow (which needs a fully rendered component).
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
beforeEach(() => {
|
|
245
|
+
localStorage.clear();
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
function extractAndSortIntoDetailKeys(): string[] {
|
|
249
|
+
const allKeys: string[] = [];
|
|
250
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
251
|
+
const k = localStorage.key(i)!;
|
|
252
|
+
if (/^\d+\./.test(k)) {
|
|
253
|
+
allKeys.push(k);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
allKeys.sort((a, b) => parseInt(a, 10) - parseInt(b, 10));
|
|
257
|
+
return allKeys;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
it('handles zero stored entries gracefully', () => {
|
|
261
|
+
const keys = extractAndSortIntoDetailKeys();
|
|
262
|
+
expect(keys).toHaveLength(0);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('returns the single entry when only one is stored', () => {
|
|
266
|
+
localStorage.setItem('1.2024.APP.ENT.TITLE', '{}');
|
|
267
|
+
const keys = extractAndSortIntoDetailKeys();
|
|
268
|
+
expect(keys).toEqual(['1.2024.APP.ENT.TITLE']);
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('sorts multiple entries ascending by numeric prefix', () => {
|
|
272
|
+
// Simulate three levels of intodetail navigation saved out-of-order
|
|
273
|
+
localStorage.setItem('3.2024.APP.ENT3.TITLE3', '{}');
|
|
274
|
+
localStorage.setItem('1.2024.APP.ENT1.TITLE1', '{}');
|
|
275
|
+
localStorage.setItem('2.2024.APP.ENT2.TITLE2', '{}');
|
|
276
|
+
|
|
277
|
+
const keys = extractAndSortIntoDetailKeys();
|
|
278
|
+
expect(keys[0]).toMatch(/^1\./); // oldest entry first
|
|
279
|
+
expect(keys[1]).toMatch(/^2\./);
|
|
280
|
+
expect(keys[2]).toMatch(/^3\./); // most recent last
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('descending sort (LIFO pop) returns the most-recently-saved entry at [0]', () => {
|
|
284
|
+
localStorage.setItem('1.2024.APP.ENT1.TITLE1', '{}');
|
|
285
|
+
localStorage.setItem('2.2024.APP.ENT2.TITLE2', '{}');
|
|
286
|
+
localStorage.setItem('3.2024.APP.ENT3.TITLE3', '{}');
|
|
287
|
+
|
|
288
|
+
const allKeys: string[] = [];
|
|
289
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
290
|
+
const k = localStorage.key(i)!;
|
|
291
|
+
if (/^\d+\./.test(k)) allKeys.push(k);
|
|
292
|
+
}
|
|
293
|
+
// This is the LIFO sort used in sendCommand exit:
|
|
294
|
+
allKeys.sort((a, b) => parseInt(b, 10) - parseInt(a, 10));
|
|
295
|
+
|
|
296
|
+
expect(allKeys[0]).toMatch(/^3\./); // top of the stack
|
|
297
|
+
expect(allKeys[1]).toMatch(/^2\./);
|
|
298
|
+
expect(allKeys[2]).toMatch(/^1\./); // bottom of the stack
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('non-numeric-prefixed keys are excluded from the intodetail list', () => {
|
|
302
|
+
localStorage.setItem('currentUser', '{}');
|
|
303
|
+
localStorage.setItem('origin', 'APP.ENT.2024');
|
|
304
|
+
localStorage.setItem('targetModel', 'ENT');
|
|
305
|
+
localStorage.setItem('1.2024.APP.ENT.TITLE', '{}');
|
|
306
|
+
|
|
307
|
+
const keys = extractAndSortIntoDetailKeys();
|
|
308
|
+
expect(keys).toHaveLength(1);
|
|
309
|
+
expect(keys[0]).toBe('1.2024.APP.ENT.TITLE');
|
|
310
|
+
});
|
|
311
|
+
});
|