@vulog/aima-booking 1.2.30 → 1.2.32

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 CHANGED
@@ -1,12 +1,25 @@
1
1
  {
2
2
  "name": "@vulog/aima-booking",
3
- "version": "1.2.30",
4
- "main": "dist/index.js",
3
+ "type": "module",
4
+ "version": "1.2.32",
5
+ "main": "dist/index.cjs",
5
6
  "module": "dist/index.mjs",
6
- "types": "dist/index.d.ts",
7
+ "types": "dist/index.d.cts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ }
19
+ },
7
20
  "scripts": {
8
- "build": "tsup",
9
- "dev": "tsup --watch",
21
+ "build": "tsdown",
22
+ "dev": "tsdown --watch",
10
23
  "test": "vitest run",
11
24
  "test:watch": "vitest",
12
25
  "lint": "eslint src/**/* --ext .ts"
@@ -19,8 +32,8 @@
19
32
  "author": "Vulog",
20
33
  "license": "MIT",
21
34
  "dependencies": {
22
- "@vulog/aima-client": "1.2.30",
23
- "@vulog/aima-core": "1.2.30"
35
+ "@vulog/aima-client": "1.2.32",
36
+ "@vulog/aima-core": "1.2.32"
24
37
  },
25
38
  "peerDependencies": {
26
39
  "es-toolkit": "^1.39.9",
@@ -64,9 +64,7 @@ describe('cancelBookingRequest', () => {
64
64
  productIds: ['f271997b-1184-429d-b951-bde23c1e2711'],
65
65
  preallocatedVehicleId: null,
66
66
  bookingReferenceId: 'p9JNDE',
67
- pricingDetails: [
68
- { pricingId: '0c5363cf-2763-4df7-92e4-1d66b04fc186', providerType: 'DEFAULT' },
69
- ],
67
+ pricingDetails: [{ pricingId: '0c5363cf-2763-4df7-92e4-1d66b04fc186', providerType: 'DEFAULT' }],
70
68
  earlyCancelledByUser: false,
71
69
  completed: false,
72
70
  } as unknown as SATBookingRequest;
@@ -49,20 +49,20 @@ describe('getBookingRequestByID', () => {
49
49
  warning: null,
50
50
  email: null,
51
51
  paymentReceipts: [
52
- {
53
- id: '673b64d4748a38189efe859c',
54
- pspName: 'ADYEN',
55
- pspReference: 'HHJLM9M2D725VDV6',
56
- amount: 60,
57
- currency: 'EUR',
58
- date: '2024-11-18T16:01:24.542Z',
59
- status: 'AUTHORIZED',
60
- paymentMethodType: 'CREDIT_CARD',
61
- number: 10942,
62
- metadatas: {
63
- scope: 'RENTAL',
64
- }
65
- },
52
+ {
53
+ id: '673b64d4748a38189efe859c',
54
+ pspName: 'ADYEN',
55
+ pspReference: 'HHJLM9M2D725VDV6',
56
+ amount: 60,
57
+ currency: 'EUR',
58
+ date: '2024-11-18T16:01:24.542Z',
59
+ status: 'AUTHORIZED',
60
+ paymentMethodType: 'CREDIT_CARD',
61
+ number: 10942,
62
+ metadatas: {
63
+ scope: 'RENTAL',
64
+ },
65
+ },
66
66
  ],
67
67
  credits: null,
68
68
  requiresActionReturnURL: null,
@@ -87,16 +87,14 @@ describe('getBookingRequestByID', () => {
87
87
  contractType: null,
88
88
  previous: null,
89
89
  customPrice: null,
90
- productIds: [
91
- 'f271997b-1184-429d-b951-bde23c1e2711'
92
- ],
90
+ productIds: ['f271997b-1184-429d-b951-bde23c1e2711'],
93
91
  preallocatedVehicleId: null,
94
92
  bookingReferenceId: 'bW9ACW',
95
93
  pricingDetails: [
96
- {
97
- pricingId: '4405ffcb-5573-4fe3-8f19-5a3433b59bf4',
98
- providerType: 'DEFAULT',
99
- }
94
+ {
95
+ pricingId: '4405ffcb-5573-4fe3-8f19-5a3433b59bf4',
96
+ providerType: 'DEFAULT',
97
+ },
100
98
  ],
101
99
  earlyCancelledByUser: false,
102
100
  completed: true,
@@ -108,9 +106,7 @@ describe('getBookingRequestByID', () => {
108
106
  const brId = randomUUID();
109
107
  const result = await getBookingRequestById(client, brId);
110
108
  expect(getMock).toBeCalled();
111
- expect(getMock).toBeCalledWith(
112
- `/boapi/proxy/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/${brId}`
113
- );
109
+ expect(getMock).toBeCalledWith(`/boapi/proxy/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/${brId}`);
114
110
  expect(result).toBeTruthy();
115
111
  expect(result.id).toEqual(data.id);
116
112
  expect(result.startDate).toEqual(data.startDate);
@@ -251,16 +247,14 @@ describe('getBookingRequestByTripID', () => {
251
247
  contractType: null,
252
248
  previous: null,
253
249
  customPrice: null,
254
- productIds: [
255
- 'f271997b-1184-429d-b951-bde23c1e2711'
256
- ],
250
+ productIds: ['f271997b-1184-429d-b951-bde23c1e2711'],
257
251
  preallocatedVehicleId: null,
258
252
  bookingReferenceId: 'bW9ACW',
259
253
  pricingDetails: [
260
- {
261
- pricingId: '4405ffcb-5573-4fe3-8f19-5a3433b59bf4',
262
- providerType: 'DEFAULT',
263
- }
254
+ {
255
+ pricingId: '4405ffcb-5573-4fe3-8f19-5a3433b59bf4',
256
+ providerType: 'DEFAULT',
257
+ },
264
258
  ],
265
259
  earlyCancelledByUser: false,
266
260
  completed: true,
@@ -366,9 +360,7 @@ describe('getsubscriptionBookingRequestByID', () => {
366
360
  serviceId: '71ee2cd8-1857-407e-adb9-e323311b3620',
367
361
  cityId: 'a91a8d56-4bf8-4a88-9afb-3f3cc255e4f8',
368
362
  pricingId: null,
369
- productIds: [
370
- 'f271997b-1184-429d-b951-bde23c1e2711'
371
- ],
363
+ productIds: ['f271997b-1184-429d-b951-bde23c1e2711'],
372
364
  modelBasePrice: null,
373
365
  modelRate: null,
374
366
  vehicleResidualValue: null,
@@ -432,7 +424,7 @@ describe('getsubscriptionBookingRequestByID', () => {
432
424
  expect(result.modelName).toEqual(data.modelName);
433
425
  expect(result.vehiclePlate).toEqual(data.vehiclePlate);
434
426
  expect(result.journeyId).toEqual(data.journeyId);
435
- expect(result.returnedDate).toEqual(data.returnedDate);
427
+ expect(result.returnedDate).toEqual(data.returnedDate);
436
428
  expect(result.cancellationDate).toEqual(data.cancellationDate);
437
429
  expect(result.contractType).toEqual(data.contractType);
438
430
  expect(result.parentId).toEqual(data.parentId);
@@ -44,9 +44,7 @@ describe('getBookingRequests', () => {
44
44
  await rejects.toSatisfy((error: any) => {
45
45
  expect(error).toHaveProperty('cause');
46
46
  expect(error.cause.length).toBeGreaterThanOrEqual(1);
47
- const pageError = error.cause.find(
48
- (e: any) => e.path && e.path[0] === 'page' && e.code === 'too_small'
49
- );
47
+ const pageError = error.cause.find((e: any) => e.path && e.path[0] === 'page' && e.code === 'too_small');
50
48
  expect(pageError).toBeDefined();
51
49
  return true;
52
50
  });
@@ -103,7 +101,7 @@ describe('getBookingRequests', () => {
103
101
  const result = await getBookingRequests(client, 'UPCOMING');
104
102
  expect(getMock).toBeCalled();
105
103
  expect(getMock).toBeCalledWith(
106
- '/boapi/proxy/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/status/UPCOMING/filters?page=0&pageSize=100&startDate=2025-01-12T13%3A35%3A50Z&endDate=2025-03-12T13%3A35%3A50Z'
104
+ '/boapi/proxy/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/status/UPCOMING/filters?page=0&size=100&startDate=2025-01-12T13%3A35%3A50Z&endDate=2025-03-12T13%3A35%3A50Z'
107
105
  );
108
106
  expect(result).toEqual({
109
107
  data: [],
@@ -132,7 +130,7 @@ describe('getBookingRequests', () => {
132
130
  });
133
131
  expect(getMock).toBeCalled();
134
132
  expect(getMock).toBeCalledWith(
135
- '/boapi/proxy/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/status/UPCOMING/filters?page=0&pageSize=100&serviceTypes=ROUND_TRIP_BOOKING%2CSCHEDULED_BOOKING_STATION&startDate=2025-01-12T13%3A35%3A50Z&endDate=2025-03-12T13%3A35%3A50Z'
133
+ '/boapi/proxy/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/status/UPCOMING/filters?page=0&size=100&serviceTypes=ROUND_TRIP_BOOKING%2CSCHEDULED_BOOKING_STATION&startDate=2025-01-12T13%3A35%3A50Z&endDate=2025-03-12T13%3A35%3A50Z'
136
134
  );
137
135
  expect(result).toEqual({
138
136
  data: [],
@@ -61,9 +61,7 @@ describe('getBookingRequestsByUserId', () => {
61
61
 
62
62
  const result = await getBookingRequestsByUserId(client, userId);
63
63
 
64
- expect(getMock).toHaveBeenCalledWith(
65
- `/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/users/${userId}`
66
- );
64
+ expect(getMock).toHaveBeenCalledWith(`/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/users/${userId}`);
67
65
  expect(result).toEqual(data);
68
66
  });
69
67
 
@@ -75,9 +73,7 @@ describe('getBookingRequestsByUserId', () => {
75
73
 
76
74
  const result = await getBookingRequestsByUserId(client, userId);
77
75
 
78
- expect(getMock).toHaveBeenCalledWith(
79
- `/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/users/${userId}`
80
- );
76
+ expect(getMock).toHaveBeenCalledWith(`/user/scheduledBooking/fleets/FLEET_ID/bookingrequests/users/${userId}`);
81
77
  expect(result).toEqual([]);
82
78
  });
83
79
 
@@ -128,7 +128,7 @@ describe('getSATBookingRequests', () => {
128
128
  const result = await getSATBookingRequests(client, 'PENDING', {
129
129
  pageSize: 10,
130
130
  sort: 'id',
131
- sortDirection: 'DESC'
131
+ sortDirection: 'DESC',
132
132
  });
133
133
  expect(getMock).toBeCalled();
134
134
  expect(getMock).toBeCalledWith(
@@ -157,11 +157,11 @@ describe('getSATBookingRequests', () => {
157
157
  const result = await getSATBookingRequests(client, 'COMPLETED', {
158
158
  page: 1,
159
159
  pageSize: 50,
160
- sort: 'creationDate'
160
+ sort: 'creationDate',
161
161
  });
162
162
  expect(getMock).toBeCalled();
163
163
  expect(getMock).toBeCalledWith(
164
- `/boapi/proxy/user/scheduleATrip/fleets/FLEET_ID/bookingrequests/status/COMPLETED?page=1&size=50&sort=creationDate`
164
+ `/boapi/proxy/user/scheduleATrip/fleets/FLEET_ID/bookingrequests/status/COMPLETED?page=1&size=50&sort=creationDate%2CASC`
165
165
  );
166
166
  expect(result).toEqual({
167
167
  data: [],
@@ -6,7 +6,7 @@ import { DayOpeningHours, Service, Station } from './types';
6
6
 
7
7
  const FLEET_ID = 'FLEET_ID';
8
8
  const STATION_ID: string = 'd7d70752-8cf5-4352-a420-33170785976e';
9
- const POI_ID = '9967b01d3a46469896888b458904669e'
9
+ const POI_ID = '9967b01d3a46469896888b458904669e';
10
10
  const STATION = {
11
11
  id: STATION_ID,
12
12
  zoneId: 'f40b8255b4b24e7cb7e5f28553e79c7e',
@@ -28,7 +28,7 @@ const STATION = {
28
28
  closeAt: '23:59',
29
29
  closed: false,
30
30
  weekDay: 'MONDAY',
31
- }
31
+ },
32
32
  ],
33
33
  TUESDAY: [
34
34
  {
@@ -37,7 +37,7 @@ const STATION = {
37
37
  closeAt: '23:59',
38
38
  closed: false,
39
39
  weekDay: 'TUESDAY',
40
- }
40
+ },
41
41
  ],
42
42
  WEDNESDAY: [
43
43
  {
@@ -46,7 +46,7 @@ const STATION = {
46
46
  closeAt: '23:59',
47
47
  closed: false,
48
48
  weekDay: 'WEDNESDAY',
49
- }
49
+ },
50
50
  ],
51
51
  THURSDAY: [
52
52
  {
@@ -55,7 +55,7 @@ const STATION = {
55
55
  closeAt: '23:59',
56
56
  closed: false,
57
57
  weekDay: 'THURSDAY',
58
- }
58
+ },
59
59
  ],
60
60
  FRIDAY: [
61
61
  {
@@ -64,7 +64,7 @@ const STATION = {
64
64
  closeAt: '23:59',
65
65
  closed: false,
66
66
  weekDay: 'FRIDAY',
67
- }
67
+ },
68
68
  ],
69
69
  SATURDAY: [
70
70
  {
@@ -73,7 +73,7 @@ const STATION = {
73
73
  closeAt: '23:59',
74
74
  closed: false,
75
75
  weekDay: 'SATURDAY',
76
- }
76
+ },
77
77
  ],
78
78
  SUNDAY: [
79
79
  {
@@ -82,8 +82,8 @@ const STATION = {
82
82
  closeAt: '23:59',
83
83
  closed: false,
84
84
  weekDay: 'SUNDAY',
85
- }
86
- ]
85
+ },
86
+ ],
87
87
  },
88
88
  },
89
89
  description: null,
@@ -99,34 +99,31 @@ const POI = {
99
99
  address: 'av Simone Veil',
100
100
  postal_code: '06000',
101
101
  city: 'Nice',
102
- capacity: 0
102
+ capacity: 0,
103
103
  },
104
104
  geometry: {
105
105
  type: 'Point',
106
- coordinates: [
107
- -7.852491,
108
- 42.282294
109
- ]
110
- }
106
+ coordinates: [-7.852491, 42.282294],
107
+ },
111
108
  };
112
109
  const STATION_MODELS = {
113
110
  station: {
114
111
  id: STATION.id,
115
112
  models: [
116
- { id: 1950, vehicles: [ '52d8c237-03a8-4b2d-bc66-f52a5d5c5119' ] },
117
- { id: 1981, vehicles: [ 'c20bc631-9943-444d-b025-b5cf78b68084' ] },
113
+ { id: 1950, vehicles: ['52d8c237-03a8-4b2d-bc66-f52a5d5c5119'] },
114
+ { id: 1981, vehicles: ['c20bc631-9943-444d-b025-b5cf78b68084'] },
118
115
  ],
119
116
  openTime: STATION.openTime,
120
117
  closeTime: STATION.closeTime,
121
- maxAvailableSpots: 0
118
+ maxAvailableSpots: 0,
122
119
  },
123
120
  serviceId: '55160733-334d-40fb-b80f-bad7080f90de',
124
121
  stationTimetableDTO: {
125
122
  stationId: null,
126
123
  fleetId: null,
127
124
  alwaysOpen: false,
128
- timetable: null
129
- }
125
+ timetable: null,
126
+ },
130
127
  };
131
128
 
132
129
  const expectStationTimeTableDay = (value: DayOpeningHours[] | undefined, expected: DayOpeningHours[]) => {
@@ -139,34 +136,48 @@ const expectStationTimeTableDay = (value: DayOpeningHours[] | undefined, expecte
139
136
  expect(value[0].openAt).toEqual(expected[0].openAt);
140
137
  expect(value[0].closeAt).toEqual(expected[0].closeAt);
141
138
  }
142
- }
139
+ };
143
140
 
144
141
  const expectStation = (value: Station | null, expected: Station) => {
145
-
146
- expect(value).not.toBeNull();
147
- expect(value).not.toBeUndefined();
148
- expect(value?.id).toEqual(expected.id);
149
- expect(value?.zoneId).toEqual(expected.zoneId);
150
- expect(value?.poiId).toEqual(expected.poiId);
151
- expect(value?.modificationDate).toEqual(expected.modificationDate);
152
- expect(value?.fleetId).toEqual(expected.fleetId);
153
- expect(value?.openingHours).not.toBeNull();
154
- expect(value?.openingHours?.alwaysOpen).toEqual(expected.stationTimetableDTO.alwaysOpen);
155
- expect(value?.openingHours?.timetable).not.toBeNull();
156
- expect(value?.openingHours?.timetable?.MONDAY).not.toBeNull();
157
- expect(value?.openingHours?.timetable?.MONDAY.length).toEqual(expected.stationTimetableDTO.timetable.MONDAY.length);
158
- expect(value?.openingHours?.timetable?.MONDAY[0].id).toEqual(expected.stationTimetableDTO.timetable.MONDAY[0].id);
159
- expect(value?.openingHours?.timetable?.MONDAY[0].closed).toEqual(expected.stationTimetableDTO.timetable.MONDAY[0].closed);
160
- expect(value?.openingHours?.timetable?.MONDAY[0].openAt).toEqual(expected.stationTimetableDTO.timetable.MONDAY[0].openAt);
161
- expect(value?.openingHours?.timetable?.MONDAY[0].closeAt).toEqual(expected.stationTimetableDTO.timetable.MONDAY[0].closeAt);
162
- expectStationTimeTableDay(value?.openingHours?.timetable?.TUESDAY, expected.stationTimetableDTO.timetable.TUESDAY);
163
- expectStationTimeTableDay(value?.openingHours?.timetable?.WEDNESDAY, expected.stationTimetableDTO.timetable.WEDNESDAY);
164
- expectStationTimeTableDay(value?.openingHours?.timetable?.THURSDAY, expected.stationTimetableDTO.timetable.THURSDAY);
165
- expectStationTimeTableDay(value?.openingHours?.timetable?.FRIDAY, expected.stationTimetableDTO.timetable.FRIDAY);
166
- expectStationTimeTableDay(value?.openingHours?.timetable?.SATURDAY, expected.stationTimetableDTO.timetable.SATURDAY);
167
- expectStationTimeTableDay(value?.openingHours?.timetable?.SUNDAY, expected.stationTimetableDTO.timetable.SUNDAY);
168
- }
169
- const expectStationInfo = (value: Station | null, expectedPoi: any) => {
142
+ expect(value).not.toBeNull();
143
+ expect(value).not.toBeUndefined();
144
+ expect(value?.id).toEqual(expected.id);
145
+ expect(value?.zoneId).toEqual(expected.zoneId);
146
+ expect(value?.poiId).toEqual(expected.poiId);
147
+ expect(value?.modificationDate).toEqual(expected.modificationDate);
148
+ expect(value?.fleetId).toEqual(expected.fleetId);
149
+ expect(value?.openingHours).not.toBeNull();
150
+ expect(value?.openingHours?.alwaysOpen).toEqual(expected.stationTimetableDTO.alwaysOpen);
151
+ expect(value?.openingHours?.timetable).not.toBeNull();
152
+ expect(value?.openingHours?.timetable?.MONDAY).not.toBeNull();
153
+ expect(value?.openingHours?.timetable?.MONDAY.length).toEqual(expected.stationTimetableDTO.timetable.MONDAY.length);
154
+ expect(value?.openingHours?.timetable?.MONDAY[0].id).toEqual(expected.stationTimetableDTO.timetable.MONDAY[0].id);
155
+ expect(value?.openingHours?.timetable?.MONDAY[0].closed).toEqual(
156
+ expected.stationTimetableDTO.timetable.MONDAY[0].closed
157
+ );
158
+ expect(value?.openingHours?.timetable?.MONDAY[0].openAt).toEqual(
159
+ expected.stationTimetableDTO.timetable.MONDAY[0].openAt
160
+ );
161
+ expect(value?.openingHours?.timetable?.MONDAY[0].closeAt).toEqual(
162
+ expected.stationTimetableDTO.timetable.MONDAY[0].closeAt
163
+ );
164
+ expectStationTimeTableDay(value?.openingHours?.timetable?.TUESDAY, expected.stationTimetableDTO.timetable.TUESDAY);
165
+ expectStationTimeTableDay(
166
+ value?.openingHours?.timetable?.WEDNESDAY,
167
+ expected.stationTimetableDTO.timetable.WEDNESDAY
168
+ );
169
+ expectStationTimeTableDay(
170
+ value?.openingHours?.timetable?.THURSDAY,
171
+ expected.stationTimetableDTO.timetable.THURSDAY
172
+ );
173
+ expectStationTimeTableDay(value?.openingHours?.timetable?.FRIDAY, expected.stationTimetableDTO.timetable.FRIDAY);
174
+ expectStationTimeTableDay(
175
+ value?.openingHours?.timetable?.SATURDAY,
176
+ expected.stationTimetableDTO.timetable.SATURDAY
177
+ );
178
+ expectStationTimeTableDay(value?.openingHours?.timetable?.SUNDAY, expected.stationTimetableDTO.timetable.SUNDAY);
179
+ };
180
+ const expectStationInfo = (value: Station | null, expectedPoi: any) => {
170
181
  expect(value?.name).toEqual(expectedPoi.properties.name);
171
182
  expect(value?.coordinates?.latitude).toEqual(expectedPoi.geometry.coordinates[1]);
172
183
  expect(value?.coordinates?.longitude).toEqual(expectedPoi.geometry.coordinates[0]);
@@ -176,18 +187,18 @@ const expectStationInfo = (value: Station | null, expectedPoi: any) => {
176
187
  expect(value?.geoProperties?.address).toEqual(expectedPoi.properties.address);
177
188
  expect(value?.geoProperties?.postal_code).toEqual(expectedPoi.properties.postal_code);
178
189
  expect(value?.geoProperties?.city).toEqual(expectedPoi.properties.city);
179
- }
190
+ };
180
191
  const expectStationServices = (value: Service[] | undefined, expectedStationModels: any) => {
181
192
  expect(value).not.toBeUndefined();
182
- expect(value?.length).toEqual(1);// 1 service for station ?
193
+ expect(value?.length).toEqual(1); // 1 service for station ?
183
194
  if (value) {
184
195
  expect(value[0].id).toEqual(expectedStationModels.serviceId);
185
196
  expect(value[0].models.length).toEqual(expectedStationModels.station.models.length);
186
197
  expect(value[0].models[0].id).toEqual(expectedStationModels.station.models[0].id);
187
198
  expect(value[0].models[0].vehicles.length).toEqual(expectedStationModels.station.models[0].vehicles.length);
188
199
  expect(value[0].models[0].vehicles[0]).toEqual(expectedStationModels.station.models[0].vehicles[0]);
189
- }
190
- }
200
+ }
201
+ };
191
202
 
192
203
  describe('getStationById', () => {
193
204
  const getMock = vi.fn();
@@ -209,8 +220,8 @@ describe('getStationById', () => {
209
220
  status: 200,
210
221
  statusText: 'OK',
211
222
  headers: {},
212
- config: {}
213
- });
223
+ config: {},
224
+ });
214
225
  }
215
226
  if (url.startsWith(`/boapi/proxy/user/scheduledBooking/fleets/${FLEET_ID}/stations/`)) {
216
227
  return Promise.resolve({
@@ -219,15 +230,15 @@ describe('getStationById', () => {
219
230
  errorCode: 'BAD_REQUEST',
220
231
  message: 'The provided input is not valid',
221
232
  detail: null,
222
- transactionId: '8c97dc753afc43098933a73bee34c327'
233
+ transactionId: '8c97dc753afc43098933a73bee34c327',
223
234
  },
224
235
  status: 400,
225
236
  statusText: 'BAD REQUEST',
226
237
  headers: {},
227
- config: {}
228
- });
238
+ config: {},
239
+ });
229
240
  }
230
- if (url === `/boapi/proxy/geoloc/fleets/${FLEET_ID}/pois/${POI_ID}` ) {
241
+ if (url === `/boapi/proxy/geoloc/fleets/${FLEET_ID}/pois/${POI_ID}`) {
231
242
  return Promise.resolve({
232
243
  data: {
233
244
  type: 'FeatureCollection',
@@ -242,83 +253,79 @@ describe('getStationById', () => {
242
253
  address: '42 av Simone Veil',
243
254
  postal_code: '06200',
244
255
  city: 'NICE',
245
- capacity: 0
256
+ capacity: 0,
246
257
  },
247
258
  geometry: {
248
259
  type: 'Point',
249
- coordinates: [
250
- -7.85794,
251
- 42.28325
252
- ]
253
- }
254
- },
260
+ coordinates: [-7.85794, 42.28325],
261
+ },
262
+ },
255
263
  // more than 2 ... but it's OK for this test
256
264
  POI,
257
- ]
265
+ ],
258
266
  },
259
267
  status: 200,
260
268
  statusText: 'OK',
261
269
  headers: {},
262
- config: {}
263
- });
270
+ config: {},
271
+ });
264
272
  }
265
273
  if (url.startsWith(`/boapi/proxy/geoloc/fleets/${FLEET_ID}/pois/`)) {
266
274
  return Promise.resolve({
267
275
  data: {
268
276
  type: 'FeatureCollection',
269
- features: []
277
+ features: [],
270
278
  },
271
279
  status: 200,
272
280
  statusText: 'OK',
273
281
  headers: {},
274
- config: {}
275
- });
282
+ config: {},
283
+ });
276
284
  }
277
285
  if (url.startsWith(`/boapi/proxy/user/fleets/${FLEET_ID}/stations/details`)) {
278
286
  return Promise.resolve({
279
287
  data: {
280
- stations:[
288
+ stations: [
281
289
  {
282
290
  station: {
283
291
  id: '404b6ea4-2004-421c-9304-84796b018975',
284
292
  models: [],
285
293
  openTime: '00:00:00',
286
294
  closeTime: '23:59:00',
287
- maxAvailableSpots: 0
295
+ maxAvailableSpots: 0,
288
296
  },
289
297
  serviceId: '66a91a3a-12dc-40bc-8750-440f0ea14fee',
290
298
  stationTimetableDTO: {
291
299
  stationId: null,
292
300
  fleetId: null,
293
301
  alwaysOpen: false,
294
- timetable: null
295
- }
302
+ timetable: null,
303
+ },
296
304
  },
297
- STATION_MODELS,
305
+ STATION_MODELS,
298
306
  {
299
307
  station: {
300
308
  id: '95095a04-afb7-49e7-b039-5da9750c8911',
301
309
  models: [],
302
310
  openTime: '07:00:00',
303
311
  closeTime: '19:00:00',
304
- maxAvailableSpots: 0
312
+ maxAvailableSpots: 0,
305
313
  },
306
314
  serviceId: '5f53f2ab-5af0-4ef5-8138-6a5b7698397d',
307
315
  stationTimetableDTO: {
308
316
  stationId: null,
309
317
  fleetId: null,
310
318
  alwaysOpen: false,
311
- timetable: null
312
- }
319
+ timetable: null,
320
+ },
313
321
  },
314
322
  ],
315
323
  },
316
324
  status: 200,
317
325
  statusText: 'OK',
318
326
  headers: {},
319
- config: {}
320
- });
321
-
327
+ config: {},
328
+ });
322
329
  }
323
330
 
324
331
  // Pour les autres URLs, rejetez la promesse
@@ -368,10 +375,9 @@ describe('getStationById', () => {
368
375
  const station: Station | null = await getStationById(client, STATION_ID, ['INFO']);
369
376
  expect(getMock).toBeCalledTimes(2);
370
377
  expect(getMock).toBeCalledWith(`/boapi/proxy/user/scheduledBooking/fleets/${FLEET_ID}/stations/${STATION_ID}`);
371
- expect(getMock).toBeCalledWith(
372
- `/boapi/proxy/geoloc/fleets/${FLEET_ID}/pois/${POI_ID}`,
373
- { headers: { accept: 'application/vnd.geo+json' } }
374
- );
378
+ expect(getMock).toBeCalledWith(`/boapi/proxy/geoloc/fleets/${FLEET_ID}/pois/${POI_ID}`, {
379
+ headers: { accept: 'application/vnd.geo+json' },
380
+ });
375
381
  expectStation(station, STATION);
376
382
  expectStationInfo(station, POI);
377
383
  expect(station?.services).toBeUndefined();
@@ -399,10 +405,9 @@ describe('getStationById', () => {
399
405
  const station: Station | null = await getStationById(client, STATION_ID, ['INFO', 'SERVICES']);
400
406
  expect(getMock).toBeCalledTimes(3);
401
407
  expect(getMock).toBeCalledWith(`/boapi/proxy/user/scheduledBooking/fleets/${FLEET_ID}/stations/${STATION_ID}`);
402
- expect(getMock).toBeCalledWith(
403
- `/boapi/proxy/geoloc/fleets/${FLEET_ID}/pois/${POI_ID}`,
404
- { headers: { accept: 'application/vnd.geo+json' } }
405
- );
408
+ expect(getMock).toBeCalledWith(`/boapi/proxy/geoloc/fleets/${FLEET_ID}/pois/${POI_ID}`, {
409
+ headers: { accept: 'application/vnd.geo+json' },
410
+ });
406
411
  expect(getMock).toBeCalledWith(`/boapi/proxy/user/fleets/${FLEET_ID}/stations/details?showTimetable=false`);
407
412
  expectStation(station, STATION);
408
413
  expectStationInfo(station, POI);
@@ -64,9 +64,7 @@ describe('releaseBRPayment', () => {
64
64
  productIds: ['f271997b-1184-429d-b951-bde23c1e2711'],
65
65
  preallocatedVehicleId: null,
66
66
  bookingReferenceId: 'p9JNDE',
67
- pricingDetails: [
68
- { pricingId: '0c5363cf-2763-4df7-92e4-1d66b04fc186', providerType: 'DEFAULT' },
69
- ],
67
+ pricingDetails: [{ pricingId: '0c5363cf-2763-4df7-92e4-1d66b04fc186', providerType: 'DEFAULT' }],
70
68
  earlyCancelledByUser: false,
71
69
  completed: false,
72
70
  } as unknown as SATBookingRequest;
@@ -76,22 +74,18 @@ describe('releaseBRPayment', () => {
76
74
  });
77
75
 
78
76
  test('throws Invalid args when bookingRequestId is not a valid UUID', async () => {
79
- await expect(
80
- releaseBRPayment(client, 'not-a-uuid' as any, randomUUID())
81
- ).rejects.toThrow(TypeError);
82
- await expect(
83
- releaseBRPayment(client, 'not-a-uuid' as any, randomUUID())
84
- ).rejects.toMatchObject({ message: 'Invalid args' });
77
+ await expect(releaseBRPayment(client, 'not-a-uuid' as any, randomUUID())).rejects.toThrow(TypeError);
78
+ await expect(releaseBRPayment(client, 'not-a-uuid' as any, randomUUID())).rejects.toMatchObject({
79
+ message: 'Invalid args',
80
+ });
85
81
  expect(postMock).not.toHaveBeenCalled();
86
82
  });
87
83
 
88
84
  test('throws Invalid args when pspReference is not a valid UUID', async () => {
89
- await expect(
90
- releaseBRPayment(client, randomUUID(), 'not-a-uuid')
91
- ).rejects.toThrow(TypeError);
92
- await expect(
93
- releaseBRPayment(client, randomUUID(), 'not-a-uuid')
94
- ).rejects.toMatchObject({ message: 'Invalid args' });
85
+ await expect(releaseBRPayment(client, randomUUID(), 'not-a-uuid')).rejects.toThrow(TypeError);
86
+ await expect(releaseBRPayment(client, randomUUID(), 'not-a-uuid')).rejects.toMatchObject({
87
+ message: 'Invalid args',
88
+ });
95
89
  expect(postMock).not.toHaveBeenCalled();
96
90
  });
97
91