production
This commit is contained in:
@@ -98,27 +98,65 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test('Arrived_At_Pickup is what confirms it', () async {
|
||||
// ── What confirms an arrival changed, on the backend's word ──
|
||||
//
|
||||
// This demanded `status: "Arrived_At_Pickup"`. The backend team has since
|
||||
// confirmed there is **no Arrived rung in the booking-status lifecycle**:
|
||||
// it runs `pickup_scheduled → converted_to_consignment → …`, and `/reached`
|
||||
// records the arrival beside it as a timestamp.
|
||||
//
|
||||
// So the old assertion demanded evidence of a transition the backend never
|
||||
// claimed to make, and `reached` answered *unconfirmed* forever — logging a
|
||||
// gap against a healthy endpoint on every arrival. The stamp is the proof;
|
||||
// the status echoing `pickup_scheduled` is correct and expected.
|
||||
test('the arrival stamp is what confirms it', () async {
|
||||
stub({
|
||||
'/reached': jsonRes({
|
||||
'success': true,
|
||||
'data': {'bookingid': 78, 'status': 'Arrived_At_Pickup'},
|
||||
'data': {
|
||||
'bookingid': 78,
|
||||
'status': 'pickup_scheduled',
|
||||
'reachedat': '2026-08-25T12:33:02+05:30',
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
final t = MilerLifecycle.reached(await MilerApi.reached(78));
|
||||
expect(t.isConfirmed, isTrue);
|
||||
expect(t.bookingStatus, BookingStatus.arrivedAtPickup);
|
||||
expect(ApiConfig.legacyStatusFromNew('Arrived_At_Pickup'), 'arrived');
|
||||
expect(
|
||||
t.evidence,
|
||||
contains('2026-08-25T12:33:02+05:30'),
|
||||
reason: 'the log line has to say what the proof actually was',
|
||||
);
|
||||
// The status is untouched and unremarkable — that is the point.
|
||||
expect(t.bookingStatus, isNot(BookingStatus.unknown));
|
||||
});
|
||||
|
||||
test('a response naming no status at all is not confirmation', () async {
|
||||
test('a stamped arrival confirms whatever the status says', () async {
|
||||
// Including the old spelling, if a deployment still sends it: the stamp
|
||||
// is the evidence either way.
|
||||
stub({
|
||||
'/reached': jsonRes({
|
||||
'success': true,
|
||||
'data': {
|
||||
'status': 'Miler_Assigned',
|
||||
'reached_at': '2026-08-25T12:33:02Z',
|
||||
},
|
||||
}),
|
||||
});
|
||||
expect(
|
||||
MilerLifecycle.reached(await MilerApi.reached(78)).isConfirmed,
|
||||
isTrue,
|
||||
);
|
||||
});
|
||||
|
||||
test('a response with no arrival stamp is not confirmation', () async {
|
||||
stub({
|
||||
'/reached': jsonRes({'success': true, 'data': {}}),
|
||||
});
|
||||
final t = MilerLifecycle.reached(await MilerApi.reached(78));
|
||||
expect(t.isUnconfirmed, isTrue);
|
||||
expect(t.evidence, contains('no status'));
|
||||
expect(t.evidence, contains('no arrival stamp'));
|
||||
});
|
||||
|
||||
test('a refusal is a refusal, with its code', () async {
|
||||
|
||||
Reference in New Issue
Block a user