Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
793 B
1
Indexable
Never
test('should return intermediate stations in descending order', () => {
    const stations: Station[] = [
        { abbreviation: 'A', location_name: 'Station A', route_id: 'R1', sequence_id: '4' },
        { abbreviation: 'B', location_name: 'Station B', route_id: 'R1', sequence_id: '3' },
        { abbreviation: 'C', location_name: 'Station C', route_id: 'R1', sequence_id: '2' },
        { abbreviation: 'D', location_name: 'Station D', 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' },
    ]);
});