package opportunity import ( "os" "path/filepath" "testing" ) func TestLoadMissingSnapshotIsAvailableState(t *testing.T) { snapshot, err := Load(filepath.Join(t.TempDir(), "missing.json")) if err != nil || len(snapshot.Occupations) != 0 { t.Fatalf("Load missing = %#v, %v", snapshot, err) } } func TestLoadRejectsMalformedSnapshot(t *testing.T) { path := filepath.Join(t.TempDir(), "opportunity.json") if err := os.WriteFile(path, []byte(`{"version":"v1","occupations":{}}`), 0o600); err != nil { t.Fatal(err) } if _, err := Load(path); err == nil { t.Fatal("Load accepted empty snapshot") } }