147 lines
3.3 KiB
Go
147 lines
3.3 KiB
Go
package eval
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
const sampleEval = `**Archetype:** LLMOps
|
|
|
|
## G) Posting Legitimacy
|
|
|
|
Signals table:
|
|
|
|
| Signal | Finding | Weight |
|
|
|---|---|---|
|
|
| Freshness | Posted 3 days ago, Apply active | + |
|
|
| Description | Names LangChain, Ragas, specific team size | + |
|
|
| Layoffs | No news found in 2026 | neutral |
|
|
|
|
**Assessment:** High Confidence
|
|
|
|
## A) Role Summary
|
|
|
|
| Field | Value |
|
|
|---|---|
|
|
| Archetype | LLMOps |
|
|
| Domain | LLMOps |
|
|
| Function | build |
|
|
| Seniority | Staff |
|
|
| Remote | hybrid |
|
|
|
|
TL;DR: Build and operate the eval platform for their agent products.
|
|
|
|
## B) CV Match
|
|
|
|
| Requirement | CV Evidence |
|
|
|---|---|
|
|
| 5+ yrs backend | Lines 12-18 |
|
|
| Python | Lines 30-34 |
|
|
|
|
**Weighted score:** 4.2/5
|
|
|
|
## C) Level & Strategy
|
|
|
|
Sell senior on platform ownership; downlevel fallback acceptable if comp is fair.
|
|
|
|
## D) Comp & Demand
|
|
|
|
Levels.fyi shows $210-280k base for Staff LLMOps in SF.
|
|
|
|
## E) Personalization Plan
|
|
|
|
Top 5 CV edits; top 5 LinkedIn edits.
|
|
|
|
## F) Interview Plan
|
|
|
|
6 STAR+R stories mapped.
|
|
|
|
**Score:** 4.2/5 **Legitimacy:** High Confidence
|
|
`
|
|
|
|
func TestParseEvaluation_FullHappyPath(t *testing.T) {
|
|
eval, err := ParseEvaluation(sampleEval)
|
|
if err != nil {
|
|
t.Fatalf("parse: %v", err)
|
|
}
|
|
if eval.Archetype != "LLMOps" {
|
|
t.Errorf("archetype = %q, want LLMOps", eval.Archetype)
|
|
}
|
|
if eval.Score != 4.2 {
|
|
t.Errorf("score = %v, want 4.2", eval.Score)
|
|
}
|
|
if eval.Legitimacy != TierHigh {
|
|
t.Errorf("legitimacy = %q, want %q", eval.Legitimacy, TierHigh)
|
|
}
|
|
if !strings.Contains(eval.BlockA, "Build and operate") {
|
|
t.Errorf("BlockA missing expected content: %q", eval.BlockA)
|
|
}
|
|
if !strings.Contains(eval.BlockG, "High Confidence") {
|
|
t.Errorf("BlockG missing assessment: %q", eval.BlockG)
|
|
}
|
|
if !strings.Contains(eval.BlockB, "Weighted score") {
|
|
t.Errorf("BlockB missing weighted score marker")
|
|
}
|
|
}
|
|
|
|
func TestParseEvaluation_MissingSummaryFallsBackToBlockB(t *testing.T) {
|
|
input := `## B) CV Match
|
|
|
|
Requirements mapped.
|
|
|
|
**Weighted score:** 3.7/5
|
|
|
|
## G) Posting Legitimacy
|
|
|
|
**Assessment:** Proceed with Caution
|
|
`
|
|
eval, err := ParseEvaluation(input)
|
|
if err != nil {
|
|
t.Fatalf("parse: %v", err)
|
|
}
|
|
if eval.Score != 3.7 {
|
|
t.Errorf("fallback score = %v, want 3.7", eval.Score)
|
|
}
|
|
if eval.Legitimacy != TierCaution {
|
|
t.Errorf("tier = %q, want %q", eval.Legitimacy, TierCaution)
|
|
}
|
|
}
|
|
|
|
func TestParseEvaluation_EmptyInput(t *testing.T) {
|
|
if _, err := ParseEvaluation(""); err == nil {
|
|
t.Fatal("empty input should error")
|
|
}
|
|
if _, err := ParseEvaluation(" \n "); err == nil {
|
|
t.Fatal("whitespace-only should error")
|
|
}
|
|
}
|
|
|
|
func TestParseEvaluation_UnknownTierDefaults(t *testing.T) {
|
|
input := `## G) Posting Legitimacy
|
|
|
|
**Assessment:** Pending Review
|
|
`
|
|
eval, err := ParseEvaluation(input)
|
|
if err != nil {
|
|
t.Fatalf("parse: %v", err)
|
|
}
|
|
if eval.Legitimacy != TierUnknown {
|
|
t.Errorf("unknown tier should map to TierUnknown, got %q", eval.Legitimacy)
|
|
}
|
|
}
|
|
|
|
func TestParseTier_KnownValues(t *testing.T) {
|
|
cases := map[string]LegitimacyTier{
|
|
"High Confidence": TierHigh,
|
|
"high confidence": TierHigh,
|
|
"Proceed with Caution": TierCaution,
|
|
"Suspicious": TierSuspicious,
|
|
"nonsense": TierUnknown,
|
|
}
|
|
for in, want := range cases {
|
|
if got := ParseTier(in); got != want {
|
|
t.Errorf("ParseTier(%q) = %q, want %q", in, got, want)
|
|
}
|
|
}
|
|
}
|