@propriety/court-calendar 1.0.139 → 1.0.140
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/dist/index.mjs +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/__tests__/helpers/negotiations.test.ts +20 -4
- package/src/helpers/cases.ts +3 -1
- package/src/types.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12233,7 +12233,7 @@ function au(t) {
|
|
|
12233
12233
|
return iu(t) ? !1 : !t.evidence.uploaded || !t.evidence.uploaded.Evidence;
|
|
12234
12234
|
}
|
|
12235
12235
|
function L7(t) {
|
|
12236
|
-
return t.OfferedBy === "Aventine" && t.LiveOffer ===
|
|
12236
|
+
return t.OfferedBy === "Aventine" && Number(t.LiveOffer) === 1 && t.Offer != null && Number(t.Offer) !== 0;
|
|
12237
12237
|
}
|
|
12238
12238
|
function Fy(t) {
|
|
12239
12239
|
return t.stipTracking?.Status ? t.stipTracking.Status === "NyscefUploaded" || t.stipTracking.Status === "SoOrdered" : !1;
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ function makeNeg(overrides: Partial<NegotiationLog> = {}): NegotiationLog {
|
|
|
8
8
|
CaseType: 'Town',
|
|
9
9
|
Comments: '',
|
|
10
10
|
DueDate: null,
|
|
11
|
-
LiveOffer:
|
|
11
|
+
LiveOffer: 1, // real API shape: tinyint 0/1, not a JS boolean
|
|
12
12
|
Negotiator: 1,
|
|
13
13
|
Offer: 100000,
|
|
14
14
|
OfferDate: new Date('2025-01-01'),
|
|
@@ -43,14 +43,30 @@ function makeStip(overrides: Partial<StipulationStatus> = {}): StipulationStatus
|
|
|
43
43
|
// ─── isSentOffer ──────────────────────────────────────────────────────────────
|
|
44
44
|
|
|
45
45
|
describe('isSentOffer', () => {
|
|
46
|
-
it('returns true for an Aventine live offer with a real amount', () => {
|
|
47
|
-
expect(isSentOffer(makeNeg({ OfferedBy: 'Aventine', LiveOffer:
|
|
46
|
+
it('returns true for an Aventine live offer (LiveOffer = 1) with a real amount', () => {
|
|
47
|
+
expect(isSentOffer(makeNeg({ OfferedBy: 'Aventine', LiveOffer: 1, Offer: 100000 }))).toBe(true);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
it('returns
|
|
50
|
+
it('returns true when LiveOffer is the boolean true (defensive)', () => {
|
|
51
|
+
expect(isSentOffer(makeNeg({ LiveOffer: true }))).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('returns false when LiveOffer is 0 (created but not sent)', () => {
|
|
55
|
+
expect(isSentOffer(makeNeg({ LiveOffer: 0 }))).toBe(false);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('returns false when LiveOffer is the boolean false', () => {
|
|
51
59
|
expect(isSentOffer(makeNeg({ LiveOffer: false }))).toBe(false);
|
|
52
60
|
});
|
|
53
61
|
|
|
62
|
+
it('returns true when LiveOffer is the string "1"', () => {
|
|
63
|
+
expect(isSentOffer(makeNeg({ LiveOffer: '1' as unknown as number }))).toBe(true);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('returns false when LiveOffer is the string "0"', () => {
|
|
67
|
+
expect(isSentOffer(makeNeg({ LiveOffer: '0' as unknown as number }))).toBe(false);
|
|
68
|
+
});
|
|
69
|
+
|
|
54
70
|
it('returns false when the offer amount is 0', () => {
|
|
55
71
|
expect(isSentOffer(makeNeg({ Offer: 0 }))).toBe(false);
|
|
56
72
|
});
|
package/src/helpers/cases.ts
CHANGED
|
@@ -35,7 +35,9 @@ export function hasCaseUnuploadedEvidence(c: Case): boolean {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export function isSentOffer(n: NegotiationLog): boolean {
|
|
38
|
-
|
|
38
|
+
// LiveOffer is a MySQL tinyint; the API may send 0/1, true/false, or "0"/"1".
|
|
39
|
+
// Number(x) === 1 is correct for all three (and excludes the string "0", which Boolean() would not).
|
|
40
|
+
return n.OfferedBy === 'Aventine' && Number(n.LiveOffer) === 1 && n.Offer != null && Number(n.Offer) !== 0;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
export function hasCaseSentOffer(c: Case): boolean {
|
package/src/types.ts
CHANGED
|
@@ -138,7 +138,7 @@ export interface NegotiationLog {
|
|
|
138
138
|
CaseType: 'Town' | 'Village';
|
|
139
139
|
Comments: string;
|
|
140
140
|
DueDate: Date | null;
|
|
141
|
-
LiveOffer: boolean;
|
|
141
|
+
LiveOffer: boolean | number; // tinyint flag from the API: 1/0 (or true/false)
|
|
142
142
|
Negotiator: number;
|
|
143
143
|
Offer: number;
|
|
144
144
|
OfferDate: Date;
|