File size: 2,186 Bytes
d7d27a3
be97847
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d7d27a3
 
 
 
 
 
 
 
 
 
be97847
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""Skill files, registry, and skill-specific response caps."""

import pytest

import config
from config import get_settings
from graph import build_llm
from skills import ACTIONS, DRAFTING_SKILLS, SKILLS, load_skill


def test_there_are_exactly_four_skill_buttons():
    assert list(ACTIONS) == ["review", "ats", "cover_letter", "email"]


@pytest.mark.parametrize("key", list(SKILLS))
def test_every_skill_file_exists_and_has_content(key):
    assert len(load_skill(key)) > 500


@pytest.mark.parametrize("key", list(SKILLS))
def test_every_button_has_a_label_and_instruction(key):
    label, instruction = ACTIONS[key]
    assert label.strip()
    assert "job description" in instruction.lower()


def test_drafting_skills_are_real_skills():
    assert DRAFTING_SKILLS <= set(SKILLS)


def test_the_ats_skill_leaves_scoring_to_python():
    text = load_skill("ats")
    assert "NOT yours to compute" in text
    assert "Output a bolded ATS Match Score" not in text


@pytest.mark.parametrize("key", ["review", "cover_letter", "email"])
def test_skills_that_need_a_job_description_are_told_where_it_is(key):
    assert "<job_description>" in load_skill(key)


def test_cover_letter_skill_requires_a_conventional_letter_only():
    text = load_skill("cover_letter")
    assert "standard letter" in text
    assert "Return only the finished cover letter" in text
    assert "Do not use section headings" in text
    assert "bullet points" in text


def test_email_skill_returns_only_one_final_email_without_explanation():
    text = load_skill("email")
    assert "one subject line, not options" in text
    assert "Do not reveal analysis or reasoning" in text
    assert "Return only the finished email" in text
    assert "Do not add a heading, introduction, alternatives, explanation, rationale, suggestions" in text
    assert "3 highly optimized" not in text


def test_prose_skill_responses_are_capped_at_6500_tokens():
    assert get_settings().skill_max_tokens == 6500 == config.DEFAULT_SKILL_MAX_TOKENS


def test_build_llm_can_override_the_response_cap():
    assert build_llm(max_tokens=6500).max_tokens == 6500
    assert build_llm().max_tokens == get_settings().max_tokens