@memberjunction/ng-agent-requests 5.42.0 → 5.44.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.
- package/package.json +9 -8
- package/dist/__tests__/agent-request-panel.test.d.ts +0 -2
- package/dist/__tests__/agent-request-panel.test.d.ts.map +0 -1
- package/dist/__tests__/agent-request-panel.test.js +0 -273
- package/dist/__tests__/agent-request-panel.test.js.map +0 -1
- package/dist/__tests__/index.test.d.ts +0 -2
- package/dist/__tests__/index.test.d.ts.map +0 -1
- package/dist/__tests__/index.test.js +0 -7
- package/dist/__tests__/index.test.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-agent-requests",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.44.0",
|
|
4
4
|
"description": "MemberJunction: Angular components for AI agent request management - panels and dialogs for viewing and responding to agent feedback requests",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@angular/compiler": "21.1.3",
|
|
26
26
|
"@angular/compiler-cli": "21.1.3",
|
|
27
|
+
"@memberjunction/ng-test-utils": "5.44.0",
|
|
27
28
|
"vitest": "^4.0.18"
|
|
28
29
|
},
|
|
29
30
|
"peerDependencies": {
|
|
@@ -32,13 +33,13 @@
|
|
|
32
33
|
"@angular/forms": "21.1.3"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@memberjunction/core": "5.
|
|
36
|
-
"@memberjunction/core-entities": "5.
|
|
37
|
-
"@memberjunction/global": "5.
|
|
38
|
-
"@memberjunction/ai-core-plus": "5.
|
|
39
|
-
"@memberjunction/ng-forms": "5.
|
|
40
|
-
"@memberjunction/ng-notifications": "5.
|
|
41
|
-
"@memberjunction/ng-shared-generic": "5.
|
|
36
|
+
"@memberjunction/core": "5.44.0",
|
|
37
|
+
"@memberjunction/core-entities": "5.44.0",
|
|
38
|
+
"@memberjunction/global": "5.44.0",
|
|
39
|
+
"@memberjunction/ai-core-plus": "5.44.0",
|
|
40
|
+
"@memberjunction/ng-forms": "5.44.0",
|
|
41
|
+
"@memberjunction/ng-notifications": "5.44.0",
|
|
42
|
+
"@memberjunction/ng-shared-generic": "5.44.0",
|
|
42
43
|
"tslib": "^2.8.1",
|
|
43
44
|
"rxjs": "^7.8.2"
|
|
44
45
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-request-panel.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/agent-request-panel.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
-
/**
|
|
3
|
-
* Tests for AgentRequestPanelComponent pure logic.
|
|
4
|
-
* All Angular decorators and DI mocked — we test computed getters and state transitions.
|
|
5
|
-
*/
|
|
6
|
-
vi.mock('@angular/core', () => ({
|
|
7
|
-
Component: () => (target) => target,
|
|
8
|
-
Input: () => () => { },
|
|
9
|
-
Output: () => () => { },
|
|
10
|
-
ChangeDetectorRef: class {
|
|
11
|
-
markForCheck() { }
|
|
12
|
-
detectChanges() { }
|
|
13
|
-
},
|
|
14
|
-
ChangeDetectionStrategy: { OnPush: 1 },
|
|
15
|
-
OnInit: class {
|
|
16
|
-
},
|
|
17
|
-
OnDestroy: class {
|
|
18
|
-
},
|
|
19
|
-
HostListener: () => () => { },
|
|
20
|
-
ViewChild: () => () => { },
|
|
21
|
-
ElementRef: class {
|
|
22
|
-
},
|
|
23
|
-
EventEmitter: class {
|
|
24
|
-
emit = vi.fn();
|
|
25
|
-
subscribe = vi.fn();
|
|
26
|
-
},
|
|
27
|
-
}));
|
|
28
|
-
vi.mock('@memberjunction/core', () => ({
|
|
29
|
-
RunView: function RunView() { return { RunView: vi.fn() }; },
|
|
30
|
-
}));
|
|
31
|
-
vi.mock('@memberjunction/core-entities', () => ({
|
|
32
|
-
MJAIAgentRequestEntity: class {
|
|
33
|
-
},
|
|
34
|
-
MJAIAgentRequestTypeEntity: class {
|
|
35
|
-
},
|
|
36
|
-
UserInfoEngine: { Instance: { GetSetting: vi.fn().mockReturnValue(null), SetSettingDebounced: vi.fn() } },
|
|
37
|
-
}));
|
|
38
|
-
vi.mock('@memberjunction/global', () => ({
|
|
39
|
-
UUIDsEqual: (a, b) => a?.toLowerCase() === b?.toLowerCase(),
|
|
40
|
-
}));
|
|
41
|
-
vi.mock('@memberjunction/ng-notifications', () => ({
|
|
42
|
-
MJNotificationService: class {
|
|
43
|
-
CreateSimpleNotification = vi.fn();
|
|
44
|
-
},
|
|
45
|
-
}));
|
|
46
|
-
vi.mock('@memberjunction/ai-core-plus', () => ({
|
|
47
|
-
AgentResponseForm: class {
|
|
48
|
-
},
|
|
49
|
-
}));
|
|
50
|
-
vi.mock('@memberjunction/ng-forms', () => ({
|
|
51
|
-
DynamicFormComponent: class {
|
|
52
|
-
},
|
|
53
|
-
}));
|
|
54
|
-
import { AgentRequestPanelComponent } from '../lib/panels/agent-request-panel/agent-request-panel.component';
|
|
55
|
-
function createMockRequest(overrides = {}) {
|
|
56
|
-
return {
|
|
57
|
-
ID: 'req-001', Status: 'Requested', Priority: 50,
|
|
58
|
-
RequestTypeID: 'type-001', RequestForUserID: 'user-001',
|
|
59
|
-
ExpiresAt: null, ResponseSchema: null, Response: null,
|
|
60
|
-
ResponseData: null, Comments: null,
|
|
61
|
-
Save: vi.fn().mockResolvedValue(true),
|
|
62
|
-
...overrides,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function createMockRequestType(overrides = {}) {
|
|
66
|
-
return { ID: 'type-001', Name: 'Feedback', ...overrides };
|
|
67
|
-
}
|
|
68
|
-
describe('AgentRequestPanelComponent', () => {
|
|
69
|
-
let component;
|
|
70
|
-
const mockCdr = { markForCheck: vi.fn(), detectChanges: vi.fn() };
|
|
71
|
-
const mockNotification = { CreateSimpleNotification: vi.fn() };
|
|
72
|
-
beforeEach(() => {
|
|
73
|
-
vi.clearAllMocks();
|
|
74
|
-
component = new AgentRequestPanelComponent(mockCdr, mockNotification);
|
|
75
|
-
});
|
|
76
|
-
describe('PriorityLabel', () => {
|
|
77
|
-
it('should return empty string when no request', () => {
|
|
78
|
-
component.Request = null;
|
|
79
|
-
expect(component.PriorityLabel).toBe('');
|
|
80
|
-
});
|
|
81
|
-
it('should return "Low" for priority <= 25', () => {
|
|
82
|
-
component.Request = createMockRequest({ Priority: 10 });
|
|
83
|
-
expect(component.PriorityLabel).toBe('Low');
|
|
84
|
-
});
|
|
85
|
-
it('should return "Low" for priority exactly 25', () => {
|
|
86
|
-
component.Request = createMockRequest({ Priority: 25 });
|
|
87
|
-
expect(component.PriorityLabel).toBe('Low');
|
|
88
|
-
});
|
|
89
|
-
it('should return "Normal" for priority 26-50', () => {
|
|
90
|
-
component.Request = createMockRequest({ Priority: 50 });
|
|
91
|
-
expect(component.PriorityLabel).toBe('Normal');
|
|
92
|
-
});
|
|
93
|
-
it('should return "High" for priority 51-75', () => {
|
|
94
|
-
component.Request = createMockRequest({ Priority: 75 });
|
|
95
|
-
expect(component.PriorityLabel).toBe('High');
|
|
96
|
-
});
|
|
97
|
-
it('should return "Critical" for priority > 75', () => {
|
|
98
|
-
component.Request = createMockRequest({ Priority: 100 });
|
|
99
|
-
expect(component.PriorityLabel).toBe('Critical');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
describe('PriorityClass', () => {
|
|
103
|
-
it('should return empty string when no request', () => {
|
|
104
|
-
component.Request = null;
|
|
105
|
-
expect(component.PriorityClass).toBe('');
|
|
106
|
-
});
|
|
107
|
-
it('should return "priority-low" for priority <= 25', () => {
|
|
108
|
-
component.Request = createMockRequest({ Priority: 10 });
|
|
109
|
-
expect(component.PriorityClass).toBe('priority-low');
|
|
110
|
-
});
|
|
111
|
-
it('should return "priority-normal" for priority 26-50', () => {
|
|
112
|
-
component.Request = createMockRequest({ Priority: 40 });
|
|
113
|
-
expect(component.PriorityClass).toBe('priority-normal');
|
|
114
|
-
});
|
|
115
|
-
it('should return "priority-high" for priority 51-75', () => {
|
|
116
|
-
component.Request = createMockRequest({ Priority: 60 });
|
|
117
|
-
expect(component.PriorityClass).toBe('priority-high');
|
|
118
|
-
});
|
|
119
|
-
it('should return "priority-critical" for priority > 75', () => {
|
|
120
|
-
component.Request = createMockRequest({ Priority: 90 });
|
|
121
|
-
expect(component.PriorityClass).toBe('priority-critical');
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
describe('IsActionable', () => {
|
|
125
|
-
it('should return true when status is Requested', () => {
|
|
126
|
-
component.Request = createMockRequest({ Status: 'Requested' });
|
|
127
|
-
expect(component.IsActionable).toBe(true);
|
|
128
|
-
});
|
|
129
|
-
it('should return false when status is Approved', () => {
|
|
130
|
-
component.Request = createMockRequest({ Status: 'Approved' });
|
|
131
|
-
expect(component.IsActionable).toBe(false);
|
|
132
|
-
});
|
|
133
|
-
it('should return false when request is null', () => {
|
|
134
|
-
component.Request = null;
|
|
135
|
-
expect(component.IsActionable).toBe(false);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
describe('IsApprovalType', () => {
|
|
139
|
-
it('should return true when request type is Approval', () => {
|
|
140
|
-
component.Request = createMockRequest({ RequestTypeID: 'type-002' });
|
|
141
|
-
component.RequestTypes = [createMockRequestType({ ID: 'type-002', Name: 'Approval' })];
|
|
142
|
-
expect(component.IsApprovalType).toBe(true);
|
|
143
|
-
});
|
|
144
|
-
it('should return false when request type is not Approval', () => {
|
|
145
|
-
component.Request = createMockRequest({ RequestTypeID: 'type-001' });
|
|
146
|
-
component.RequestTypes = [createMockRequestType({ ID: 'type-001', Name: 'Feedback' })];
|
|
147
|
-
expect(component.IsApprovalType).toBe(false);
|
|
148
|
-
});
|
|
149
|
-
it('should return false when no matching request type', () => {
|
|
150
|
-
component.Request = createMockRequest({ RequestTypeID: 'nonexistent' });
|
|
151
|
-
component.RequestTypes = [createMockRequestType()];
|
|
152
|
-
expect(component.IsApprovalType).toBe(false);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
describe('IsExpired', () => {
|
|
156
|
-
it('should return false when ExpiresAt is null', () => {
|
|
157
|
-
component.Request = createMockRequest({ ExpiresAt: null });
|
|
158
|
-
expect(component.IsExpired).toBe(false);
|
|
159
|
-
});
|
|
160
|
-
it('should return true when ExpiresAt is in the past', () => {
|
|
161
|
-
component.Request = createMockRequest({ ExpiresAt: new Date(Date.now() - 86400000).toISOString() });
|
|
162
|
-
expect(component.IsExpired).toBe(true);
|
|
163
|
-
});
|
|
164
|
-
it('should return false when ExpiresAt is in the future', () => {
|
|
165
|
-
component.Request = createMockRequest({ ExpiresAt: new Date(Date.now() + 86400000).toISOString() });
|
|
166
|
-
expect(component.IsExpired).toBe(false);
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
describe('HasResponseForm', () => {
|
|
170
|
-
it('should return false when null', () => {
|
|
171
|
-
component.ResponseFormDefinition = null;
|
|
172
|
-
expect(component.HasResponseForm).toBe(false);
|
|
173
|
-
});
|
|
174
|
-
it('should return false when questions is empty', () => {
|
|
175
|
-
component.ResponseFormDefinition = { questions: [] };
|
|
176
|
-
expect(component.HasResponseForm).toBe(false);
|
|
177
|
-
});
|
|
178
|
-
it('should return true when questions has items', () => {
|
|
179
|
-
component.ResponseFormDefinition = { questions: [{ id: 'q1' }] };
|
|
180
|
-
expect(component.HasResponseForm).toBe(true);
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
describe('RequestType lookup', () => {
|
|
184
|
-
it('should return matching request type (case-insensitive UUID)', () => {
|
|
185
|
-
const reqType = createMockRequestType({ ID: 'TYPE-001', Name: 'Approval' });
|
|
186
|
-
component.Request = createMockRequest({ RequestTypeID: 'type-001' });
|
|
187
|
-
component.RequestTypes = [reqType];
|
|
188
|
-
expect(component.RequestType).toBe(reqType);
|
|
189
|
-
});
|
|
190
|
-
it('should return null when no RequestTypeID', () => {
|
|
191
|
-
component.Request = createMockRequest({ RequestTypeID: null });
|
|
192
|
-
expect(component.RequestType).toBeNull();
|
|
193
|
-
});
|
|
194
|
-
it('should return null when no request', () => {
|
|
195
|
-
component.Request = null;
|
|
196
|
-
expect(component.RequestType).toBeNull();
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
describe('OnCancel', () => {
|
|
200
|
-
it('should close panel and emit cancelled', () => {
|
|
201
|
-
component.IsOpen = true;
|
|
202
|
-
component.OnCancel();
|
|
203
|
-
expect(component.IsOpen).toBe(false);
|
|
204
|
-
expect(component.Close.emit).toHaveBeenCalledWith({ Success: false, Action: 'cancelled' });
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
describe('OnReassignClick', () => {
|
|
208
|
-
it('should open reassign dialog and reset state', () => {
|
|
209
|
-
component.ReassignSearchTerm = 'old';
|
|
210
|
-
component.ReassignNote = 'old';
|
|
211
|
-
component.ReassignUsers = [{ ID: '1', Name: 'X', Email: 'x@x.com' }];
|
|
212
|
-
component.SelectedReassignUser = { ID: '1', Name: 'X', Email: 'x@x.com' };
|
|
213
|
-
component.OnReassignClick();
|
|
214
|
-
expect(component.ShowReassignDialog).toBe(true);
|
|
215
|
-
expect(component.ReassignSearchTerm).toBe('');
|
|
216
|
-
expect(component.ReassignNote).toBe('');
|
|
217
|
-
expect(component.ReassignUsers).toEqual([]);
|
|
218
|
-
expect(component.SelectedReassignUser).toBeNull();
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
describe('OnReassignCancel', () => {
|
|
222
|
-
it('should close reassign dialog', () => {
|
|
223
|
-
component.ShowReassignDialog = true;
|
|
224
|
-
component.OnReassignCancel();
|
|
225
|
-
expect(component.ShowReassignDialog).toBe(false);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
describe('OnSelectReassignUser', () => {
|
|
229
|
-
it('should set selected user', () => {
|
|
230
|
-
const user = { ID: 'u1', Name: 'Alice', Email: 'a@b.com' };
|
|
231
|
-
component.OnSelectReassignUser(user);
|
|
232
|
-
expect(component.SelectedReassignUser).toBe(user);
|
|
233
|
-
});
|
|
234
|
-
});
|
|
235
|
-
describe('OnReassignSearchChange', () => {
|
|
236
|
-
it('should clear users for short search terms', () => {
|
|
237
|
-
component.ReassignUsers = [{ ID: '1', Name: 'X', Email: 'x@x.com' }];
|
|
238
|
-
component.OnReassignSearchChange('a');
|
|
239
|
-
expect(component.ReassignUsers).toEqual([]);
|
|
240
|
-
});
|
|
241
|
-
it('should set search term', () => {
|
|
242
|
-
component.OnReassignSearchChange('alice');
|
|
243
|
-
expect(component.ReassignSearchTerm).toBe('alice');
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
describe('Panel width', () => {
|
|
247
|
-
it('should default to 520', () => {
|
|
248
|
-
expect(component.PanelWidth).toBe(520);
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
describe('OnEscapeKey', () => {
|
|
252
|
-
it('should cancel when open', () => {
|
|
253
|
-
component.IsOpen = true;
|
|
254
|
-
const spy = vi.spyOn(component, 'OnCancel');
|
|
255
|
-
component.OnEscapeKey();
|
|
256
|
-
expect(spy).toHaveBeenCalled();
|
|
257
|
-
});
|
|
258
|
-
it('should not cancel when closed', () => {
|
|
259
|
-
component.IsOpen = false;
|
|
260
|
-
const spy = vi.spyOn(component, 'OnCancel');
|
|
261
|
-
component.OnEscapeKey();
|
|
262
|
-
expect(spy).not.toHaveBeenCalled();
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
describe('OnBackdropClick', () => {
|
|
266
|
-
it('should delegate to OnCancel', () => {
|
|
267
|
-
const spy = vi.spyOn(component, 'OnCancel');
|
|
268
|
-
component.OnBackdropClick();
|
|
269
|
-
expect(spy).toHaveBeenCalled();
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
//# sourceMappingURL=agent-request-panel.test.js.map
|
|
@@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C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACnC,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YAC5C,SAAS,CAAC,eAAe,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,CAAC;QACnC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect, vi, beforeEach } from 'vitest';\n\n/**\n * Tests for AgentRequestPanelComponent pure logic.\n * All Angular decorators and DI mocked — we test computed getters and state transitions.\n */\n\nvi.mock('@angular/core', () => ({\n Component: () => (target: Function) => target,\n Input: () => () => {},\n Output: () => () => {},\n ChangeDetectorRef: class { markForCheck() {} detectChanges() {} },\n ChangeDetectionStrategy: { OnPush: 1 },\n OnInit: class {},\n OnDestroy: class {},\n HostListener: () => () => {},\n ViewChild: () => () => {},\n ElementRef: class {},\n EventEmitter: class { emit = vi.fn(); subscribe = vi.fn(); },\n}));\n\nvi.mock('@memberjunction/core', () => ({\n RunView: function RunView() { return { RunView: vi.fn() }; },\n}));\n\nvi.mock('@memberjunction/core-entities', () => ({\n MJAIAgentRequestEntity: class {},\n MJAIAgentRequestTypeEntity: class {},\n UserInfoEngine: { Instance: { GetSetting: vi.fn().mockReturnValue(null), SetSettingDebounced: vi.fn() } },\n}));\n\nvi.mock('@memberjunction/global', () => ({\n UUIDsEqual: (a: string, b: string) => a?.toLowerCase() === b?.toLowerCase(),\n}));\n\nvi.mock('@memberjunction/ng-notifications', () => ({\n MJNotificationService: class { CreateSimpleNotification = vi.fn(); },\n}));\n\nvi.mock('@memberjunction/ai-core-plus', () => ({\n AgentResponseForm: class {},\n}));\n\nvi.mock('@memberjunction/ng-forms', () => ({\n DynamicFormComponent: class {},\n}));\n\nimport { AgentRequestPanelComponent } from '../lib/panels/agent-request-panel/agent-request-panel.component';\n\nfunction createMockRequest(overrides: Record<string, unknown> = {}): Record<string, unknown> {\n return {\n ID: 'req-001', Status: 'Requested', Priority: 50,\n RequestTypeID: 'type-001', RequestForUserID: 'user-001',\n ExpiresAt: null, ResponseSchema: null, Response: null,\n ResponseData: null, Comments: null,\n Save: vi.fn().mockResolvedValue(true),\n ...overrides,\n };\n}\n\nfunction createMockRequestType(overrides: Record<string, unknown> = {}): Record<string, unknown> {\n return { ID: 'type-001', Name: 'Feedback', ...overrides };\n}\n\ndescribe('AgentRequestPanelComponent', () => {\n let component: AgentRequestPanelComponent;\n const mockCdr = { markForCheck: vi.fn(), detectChanges: vi.fn() };\n const mockNotification = { CreateSimpleNotification: vi.fn() };\n\n beforeEach(() => {\n vi.clearAllMocks();\n component = new AgentRequestPanelComponent(mockCdr as never, mockNotification as never);\n });\n\n describe('PriorityLabel', () => {\n it('should return empty string when no request', () => {\n component.Request = null;\n expect(component.PriorityLabel).toBe('');\n });\n\n it('should return \"Low\" for priority <= 25', () => {\n component.Request = createMockRequest({ Priority: 10 }) as never;\n expect(component.PriorityLabel).toBe('Low');\n });\n\n it('should return \"Low\" for priority exactly 25', () => {\n component.Request = createMockRequest({ Priority: 25 }) as never;\n expect(component.PriorityLabel).toBe('Low');\n });\n\n it('should return \"Normal\" for priority 26-50', () => {\n component.Request = createMockRequest({ Priority: 50 }) as never;\n expect(component.PriorityLabel).toBe('Normal');\n });\n\n it('should return \"High\" for priority 51-75', () => {\n component.Request = createMockRequest({ Priority: 75 }) as never;\n expect(component.PriorityLabel).toBe('High');\n });\n\n it('should return \"Critical\" for priority > 75', () => {\n component.Request = createMockRequest({ Priority: 100 }) as never;\n expect(component.PriorityLabel).toBe('Critical');\n });\n });\n\n describe('PriorityClass', () => {\n it('should return empty string when no request', () => {\n component.Request = null;\n expect(component.PriorityClass).toBe('');\n });\n\n it('should return \"priority-low\" for priority <= 25', () => {\n component.Request = createMockRequest({ Priority: 10 }) as never;\n expect(component.PriorityClass).toBe('priority-low');\n });\n\n it('should return \"priority-normal\" for priority 26-50', () => {\n component.Request = createMockRequest({ Priority: 40 }) as never;\n expect(component.PriorityClass).toBe('priority-normal');\n });\n\n it('should return \"priority-high\" for priority 51-75', () => {\n component.Request = createMockRequest({ Priority: 60 }) as never;\n expect(component.PriorityClass).toBe('priority-high');\n });\n\n it('should return \"priority-critical\" for priority > 75', () => {\n component.Request = createMockRequest({ Priority: 90 }) as never;\n expect(component.PriorityClass).toBe('priority-critical');\n });\n });\n\n describe('IsActionable', () => {\n it('should return true when status is Requested', () => {\n component.Request = createMockRequest({ Status: 'Requested' }) as never;\n expect(component.IsActionable).toBe(true);\n });\n\n it('should return false when status is Approved', () => {\n component.Request = createMockRequest({ Status: 'Approved' }) as never;\n expect(component.IsActionable).toBe(false);\n });\n\n it('should return false when request is null', () => {\n component.Request = null;\n expect(component.IsActionable).toBe(false);\n });\n });\n\n describe('IsApprovalType', () => {\n it('should return true when request type is Approval', () => {\n component.Request = createMockRequest({ RequestTypeID: 'type-002' }) as never;\n component.RequestTypes = [createMockRequestType({ ID: 'type-002', Name: 'Approval' })] as never;\n expect(component.IsApprovalType).toBe(true);\n });\n\n it('should return false when request type is not Approval', () => {\n component.Request = createMockRequest({ RequestTypeID: 'type-001' }) as never;\n component.RequestTypes = [createMockRequestType({ ID: 'type-001', Name: 'Feedback' })] as never;\n expect(component.IsApprovalType).toBe(false);\n });\n\n it('should return false when no matching request type', () => {\n component.Request = createMockRequest({ RequestTypeID: 'nonexistent' }) as never;\n component.RequestTypes = [createMockRequestType()] as never;\n expect(component.IsApprovalType).toBe(false);\n });\n });\n\n describe('IsExpired', () => {\n it('should return false when ExpiresAt is null', () => {\n component.Request = createMockRequest({ ExpiresAt: null }) as never;\n expect(component.IsExpired).toBe(false);\n });\n\n it('should return true when ExpiresAt is in the past', () => {\n component.Request = createMockRequest({ ExpiresAt: new Date(Date.now() - 86400000).toISOString() }) as never;\n expect(component.IsExpired).toBe(true);\n });\n\n it('should return false when ExpiresAt is in the future', () => {\n component.Request = createMockRequest({ ExpiresAt: new Date(Date.now() + 86400000).toISOString() }) as never;\n expect(component.IsExpired).toBe(false);\n });\n });\n\n describe('HasResponseForm', () => {\n it('should return false when null', () => {\n component.ResponseFormDefinition = null;\n expect(component.HasResponseForm).toBe(false);\n });\n\n it('should return false when questions is empty', () => {\n component.ResponseFormDefinition = { questions: [] } as never;\n expect(component.HasResponseForm).toBe(false);\n });\n\n it('should return true when questions has items', () => {\n component.ResponseFormDefinition = { questions: [{ id: 'q1' }] } as never;\n expect(component.HasResponseForm).toBe(true);\n });\n });\n\n describe('RequestType lookup', () => {\n it('should return matching request type (case-insensitive UUID)', () => {\n const reqType = createMockRequestType({ ID: 'TYPE-001', Name: 'Approval' });\n component.Request = createMockRequest({ RequestTypeID: 'type-001' }) as never;\n component.RequestTypes = [reqType] as never;\n expect(component.RequestType).toBe(reqType);\n });\n\n it('should return null when no RequestTypeID', () => {\n component.Request = createMockRequest({ RequestTypeID: null }) as never;\n expect(component.RequestType).toBeNull();\n });\n\n it('should return null when no request', () => {\n component.Request = null;\n expect(component.RequestType).toBeNull();\n });\n });\n\n describe('OnCancel', () => {\n it('should close panel and emit cancelled', () => {\n component.IsOpen = true;\n component.OnCancel();\n expect(component.IsOpen).toBe(false);\n expect(component.Close.emit).toHaveBeenCalledWith({ Success: false, Action: 'cancelled' });\n });\n });\n\n describe('OnReassignClick', () => {\n it('should open reassign dialog and reset state', () => {\n component.ReassignSearchTerm = 'old';\n component.ReassignNote = 'old';\n component.ReassignUsers = [{ ID: '1', Name: 'X', Email: 'x@x.com' }];\n component.SelectedReassignUser = { ID: '1', Name: 'X', Email: 'x@x.com' };\n component.OnReassignClick();\n expect(component.ShowReassignDialog).toBe(true);\n expect(component.ReassignSearchTerm).toBe('');\n expect(component.ReassignNote).toBe('');\n expect(component.ReassignUsers).toEqual([]);\n expect(component.SelectedReassignUser).toBeNull();\n });\n });\n\n describe('OnReassignCancel', () => {\n it('should close reassign dialog', () => {\n component.ShowReassignDialog = true;\n component.OnReassignCancel();\n expect(component.ShowReassignDialog).toBe(false);\n });\n });\n\n describe('OnSelectReassignUser', () => {\n it('should set selected user', () => {\n const user = { ID: 'u1', Name: 'Alice', Email: 'a@b.com' };\n component.OnSelectReassignUser(user);\n expect(component.SelectedReassignUser).toBe(user);\n });\n });\n\n describe('OnReassignSearchChange', () => {\n it('should clear users for short search terms', () => {\n component.ReassignUsers = [{ ID: '1', Name: 'X', Email: 'x@x.com' }];\n component.OnReassignSearchChange('a');\n expect(component.ReassignUsers).toEqual([]);\n });\n\n it('should set search term', () => {\n component.OnReassignSearchChange('alice');\n expect(component.ReassignSearchTerm).toBe('alice');\n });\n });\n\n describe('Panel width', () => {\n it('should default to 520', () => {\n expect(component.PanelWidth).toBe(520);\n });\n });\n\n describe('OnEscapeKey', () => {\n it('should cancel when open', () => {\n component.IsOpen = true;\n const spy = vi.spyOn(component, 'OnCancel');\n component.OnEscapeKey();\n expect(spy).toHaveBeenCalled();\n });\n\n it('should not cancel when closed', () => {\n component.IsOpen = false;\n const spy = vi.spyOn(component, 'OnCancel');\n component.OnEscapeKey();\n expect(spy).not.toHaveBeenCalled();\n });\n });\n\n describe('OnBackdropClick', () => {\n it('should delegate to OnCancel', () => {\n const spy = vi.spyOn(component, 'OnCancel');\n component.OnBackdropClick();\n expect(spy).toHaveBeenCalled();\n });\n });\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, it, expect } from 'vitest';\n\ndescribe('@memberjunction/ng-agent-requests', () => {\n it('should have a passing test', () => {\n expect(true).toBe(true);\n });\n});\n"]}
|