File size: 922 Bytes
d0878a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { resolveStatedGoal } from './statedGoal';

describe('resolveStatedGoal', () => {
  test('prefers stated_goal fact, then profile current_goals, then guest label', () => {
    expect(resolveStatedGoal({
      facts: [{ key: 'stated_goal', value: 'Write a novel about cat hackers' }],
      profile: { current_goals: 'IG1 hygiene' },
      user: { is_guest: true, guest_label: 'Custom' },
    })).toBe('Write a novel about cat hackers');

    expect(resolveStatedGoal({
      profile: { current_goals: 'IG1 hygiene' },
      user: { is_guest: true, guest_label: 'Custom' },
    })).toBe('IG1 hygiene');

    expect(resolveStatedGoal({
      user: { is_guest: true, guest_label: 'Custom path' },
    })).toBe('Custom path');
  });

  test('hides empty / placeholder goals', () => {
    expect(resolveStatedGoal({
      profile: { current_goals: 'not specified' },
    })).toBe('');
  });
});