mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
fix(native): the widgets show the trip the dashboard features
With several trips running at once, the widgets took whichever came first on the device, so an old test trip spanning today pushed out the journey under way, and the today widget counted its days. The dashboard's choice moves to utils/heroTrip.ts (running first, earliest start, else the next to come) and the widgets ask the same function, so the home screen always shows the trip the app opens on.
This commit is contained in:
@@ -51,6 +51,15 @@ describe('pickTrip', () => {
|
||||
expect(pickTrip(trips, '2026-11-12')?.id).toBe(2);
|
||||
});
|
||||
|
||||
it('of several running trips takes the dashboard hero: the one that started first', () => {
|
||||
const trips = [
|
||||
trip(1, '2026-11-02', '2026-11-06'),
|
||||
trip(2, '2026-10-20', '2026-11-18'),
|
||||
trip(3, '2026-11-04', '2026-11-12'),
|
||||
];
|
||||
expect(pickTrip(trips, '2026-11-06')?.id).toBe(2);
|
||||
});
|
||||
|
||||
it('skips undated, archived and finished trips', () => {
|
||||
expect(
|
||||
pickTrip(
|
||||
|
||||
Reference in New Issue
Block a user