mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 09:54:14 +00:00
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import {
|
|
isHikePlanningRequest,
|
|
wantsChallengingHike,
|
|
withChallengingHikeLimit,
|
|
} from '../../../../src/nest/assistant/assistant-hike-intent';
|
|
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('hike planning from a chat request', () => {
|
|
it('uses the challenging route profile for a request without a stated ceiling', () => {
|
|
expect(wantsChallengingHike('Leg mir mal ne Tour am Fuji an Hiking Anspruchsvoll')).toBe(true);
|
|
expect(withChallengingHikeLimit('propose_hike', { max_hiking_difficulty: 3 }, true)).toEqual({
|
|
max_hiking_difficulty: 4,
|
|
});
|
|
});
|
|
|
|
it.each([
|
|
'Plane eine anspruchsvolle Wanderung bis T3',
|
|
'Plane eine Wanderung. Sie soll nicht anspruchsvoll sein',
|
|
'Plan a challenging hike but avoid exposed terrain',
|
|
'Plan a demanding hike, at most grade 3',
|
|
])('does not replace a constrained preference in %s', (request) => {
|
|
expect(wantsChallengingHike(request)).toBe(false);
|
|
});
|
|
|
|
it('keeps difficulty limits on deliberate alternatives and saves the chosen profile as given', () => {
|
|
const easyWay = { max_hiking_difficulty: 3, variant_label: 'Easier' };
|
|
const chosen = { max_hiking_difficulty: 3 };
|
|
expect(withChallengingHikeLimit('propose_hike', easyWay, true)).toBe(easyWay);
|
|
expect(withChallengingHikeLimit('create_hike', chosen, true)).toBe(chosen);
|
|
expect(isHikePlanningRequest('Where is my train ticket?')).toBe(false);
|
|
});
|
|
});
|