Untitled
unknown
plain_text
2 years ago
1.6 kB
6
Indexable
test('should return intermediate stations in ascending order', () => { const stations: Station[] = [ { abbreviation: 'D', location_name: 'Station D', route_id: 'R1', sequence_id: '4' }, { abbreviation: 'C', location_name: 'Station C', route_id: 'R1', sequence_id: '3' }, { abbreviation: 'B', location_name: 'Station B', route_id: 'R1', sequence_id: '2' }, { abbreviation: 'A', location_name: 'Station A', route_id: 'R1', sequence_id: '1' }, ]; const result = getIntermediateStations(stations, stations[3], stations[0]); expect(result).toEqual([ { abbreviation: 'B', location_name: 'Station B', route_id: 'R1', sequence_id: '2' }, { abbreviation: 'C', location_name: 'Station C', route_id: 'R1', sequence_id: '3' }, ]); }); test('should return intermediate stations in descending order', () => { const stations: Station[] = [ { abbreviation: 'D', location_name: 'Station D', route_id: 'R1', sequence_id: '4' }, { abbreviation: 'C', location_name: 'Station C', route_id: 'R1', sequence_id: '3' }, { abbreviation: 'B', location_name: 'Station B', route_id: 'R1', sequence_id: '2' }, { abbreviation: 'A', location_name: 'Station A', route_id: 'R1', sequence_id: '1' }, ]; const result = getIntermediateStations(stations, stations[0], stations[3]); expect(result).toEqual([ { abbreviation: 'C', location_name: 'Station C', route_id: 'R1', sequence_id: '3' }, { abbreviation: 'B', location_name: 'Station B', route_id: 'R1', sequence_id: '2' }, ]); });
Editor is loading...