| 
									
										
										
										
											2022-05-07 16:17:37 +02:00
										 |  |  | import tap from 'tap' | 
					
						
							| 
									
										
										
										
											2021-07-26 17:11:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-07 16:17:37 +02:00
										 |  |  | import {createWhen} from './lib/util.js' | 
					
						
							|  |  |  | import {createClient} from '../../index.js' | 
					
						
							|  |  |  | import {profile as blsProfile} from '../../p/bls/index.js' | 
					
						
							|  |  |  | import {createValidateFptfWith as createValidate} from './lib/validate-fptf-with.js' | 
					
						
							|  |  |  | import {testJourneysStationToAddress} from './lib/journeys-station-to-address.js' | 
					
						
							| 
									
										
										
										
											2021-07-26 17:11:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-11-09 21:21:55 +01:00
										 |  |  | const T_MOCK = 1671260400 * 1000 // 2022-12-17T08:00:00+01:00
 | 
					
						
							| 
									
										
										
										
											2022-04-23 14:40:51 +02:00
										 |  |  | const when = createWhen(blsProfile.timezone, blsProfile.locale, T_MOCK) | 
					
						
							| 
									
										
										
										
											2021-07-26 17:11:02 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | const cfg = { | 
					
						
							|  |  |  | 	when, | 
					
						
							|  |  |  | 	stationCoordsOptional: false, | 
					
						
							|  |  |  | 	products: blsProfile.products, | 
					
						
							|  |  |  | 	minLatitude: 45.3184, | 
					
						
							|  |  |  | 	minLongitude: 4.4604, | 
					
						
							|  |  |  | 	maxLatitude: 47.2969, | 
					
						
							|  |  |  | 	maxLongitude: 7.8607, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const validate = createValidate(cfg) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const client = createClient(blsProfile, 'public-transport/hafas-client:test') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const bernDennigkofengässli = '8590093' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | tap.test('Dennigkofengässli to Schänzlihalde', async (t) => { | 
					
						
							|  |  |  | 	const schänzlihalde = { | 
					
						
							|  |  |  | 		type: 'location', | 
					
						
							|  |  |  | 		id: '990017698', | 
					
						
							|  |  |  | 		address: 'Bern, Schänzlihalde 17', | 
					
						
							|  |  |  | 		latitude: 46.952835, | 
					
						
							|  |  |  | 		longitude: 7.447527, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	const res = await client.journeys(bernDennigkofengässli, schänzlihalde, { | 
					
						
							|  |  |  | 		results: 3, | 
					
						
							|  |  |  | 		departure: when, | 
					
						
							|  |  |  | 	}) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	await testJourneysStationToAddress({ | 
					
						
							|  |  |  | 		test: t, | 
					
						
							|  |  |  | 		res, | 
					
						
							|  |  |  | 		validate, | 
					
						
							|  |  |  | 		fromId: bernDennigkofengässli, | 
					
						
							|  |  |  | 		to: schänzlihalde, | 
					
						
							|  |  |  | 	}) | 
					
						
							|  |  |  | 	t.end() | 
					
						
							|  |  |  | }) |