Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/ontology/adapters/onet_test.go |
| Original SHA-256 | 0cdeb048c816e66f95e9133b27344e3fef95c2a3a8dff543e18cadd3c7882725 |
| Git blob SHA | 4282bc35c4bf859beef0d21aa94fef57b8f5c364 |
| Reading-copy SHA-256 | 0cdeb048c816e66f95e9133b27344e3fef95c2a3a8dff543e18cadd3c7882725 |
Every recorded occurrence
These 20 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | ws6-retrieval | 6c56e29231ec05735927fa265c97d517499dfeaf | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | ws1-ontology-sync | b596f449a32a1016fbd403c36505cc00a1ac9ee6 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | ws8-teaching-loop | c823f0fb6bb2aba0f39001eb6de96f4000d9321f | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | ws3-clearance | 4b8e7ce594c068621867f9c9deed0ec64ae6c553 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | phase2-eval-fairness | d361af254701975fe239927656ababb56374655e | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | graphrag-foundation | b0ddeb9f633fd138d09309d1a17b7d13bc3a67f7 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | ws9-bench-ingestion | f585a9ef32fa554663ce1fba9a414a54b6e49cf0 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | ws2-alias-relationship | e4dada4601c6eb101830f9d223a9655dfa120616 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | ws7-federal-signal | 6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/modules/ontology/adapters/onet_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓264 lines · 9.6 KB
package adapters
import (
"errors"
"testing"
"github.com/missionworkforce/missionmatch/internal/modules/ontology"
)
// onetSkillsFixture is a literal JSON fragment matching the documented O*NET Web Services v2.0
// per occupation skills summary response shape:
//
// GET /online/occupations/{code}/summary/skills
// Response: { element: [{ id, name, description, related }], start, end, total, next }
//
// Confirmed from https://services.onetcenter.org/reference/online/occupation/summary/skills and
// https://services.onetcenter.org/reference/online/occupation/details/skills.
// The "id" field is the O*NET content model element id (e.g. "2.A.1.b").
// The "name" field is the human readable element name.
// The "related" field is a URL to related occupations and is not stored in VocabRecord.
const onetSkillsFixture = `{
"start": 1,
"end": 2,
"total": 2,
"element": [
{
"id": "2.A.1.b",
"related": "https://api-v2.onetcenter.org/online/occupations/17-2051.00/related/skills/2.A.1.b",
"name": "Active Listening",
"description": "Giving full attention to what other people are saying, taking time to understand the points being made, asking questions as appropriate, and not interrupting at inappropriate times."
},
{
"id": "2.A.1.a",
"related": "https://api-v2.onetcenter.org/online/occupations/17-2051.00/related/skills/2.A.1.a",
"name": "Reading Comprehension",
"description": "Understanding written sentences and paragraphs in work related documents."
}
]
}`
// onetTechSkillsFixture is a literal JSON fragment matching the documented O*NET Web Services v2.0
// per occupation technology_skills summary response shape:
//
// GET /online/occupations/{code}/summary/technology_skills
// Response: { start, end, total, next, category: [{ code, title, example: [{ title, hot_technology }] }] }
//
// Confirmed from https://services.onetcenter.org/reference/online/occupation/summary/technology_skills.
// The "category" array holds tool categories; each "example" entry is a concrete software product.
const onetTechSkillsFixture = `{
"start": 1,
"end": 2,
"total": 2,
"category": [
{
"code": 43232402,
"title": "Development environment software",
"example": [
{"title": "Apache Kafka", "hot_technology": true},
{"title": "Microsoft Visual Studio"}
]
},
{
"code": 43232305,
"title": "Object or component oriented development software",
"example": [
{"title": "Go"}
]
}
]
}`
// onetOccupationsFixture is a literal JSON fragment matching the documented O*NET Web Services
// v2.0 occupations list response shape:
//
// GET /online/occupations/
// Response: { occupation: [{ code, title, href, tags, datalevel }], start, end, total, next }
//
// Confirmed from https://services.onetcenter.org/reference/online/browse/occupations.
const onetOccupationsFixture = `{
"start": 1,
"end": 2,
"total": 2,
"occupation": [
{
"href": "https://api-v2.onetcenter.org/online/occupations/17-2051.00/",
"code": "17-2051.00",
"title": "Civil Engineers"
},
{
"href": "https://api-v2.onetcenter.org/online/occupations/15-1252.00/",
"code": "15-1252.00",
"title": "Software Developers"
}
]
}`
// TestParseONETSkills feeds the documented skills fixture to parseONETElement and confirms it
// returns the expected KindSkill VocabRecords. The SourceRecordID must use the global
// "onet:<elementID>" scheme so a single distinct element yields exactly one row across all
// occupations (dedup is enforced in Fetch via the seen map, but the key itself is occupation
// independent).
func TestParseONETSkills(t *testing.T) {
recs, err := parseONETElement([]byte(onetSkillsFixture), "17-2051.00", "skill", ontology.KindSkill)
if err != nil {
t.Fatalf("parseONETElement (skill) returned an error: %v", err)
}
if len(recs) != 2 {
t.Fatalf("want 2 records, got %d", len(recs))
}
// First element: 2.A.1.b / Active Listening
r0 := recs[0]
if r0.Kind != ontology.KindSkill {
t.Errorf("recs[0]: want Kind %q, got %q", ontology.KindSkill, r0.Kind)
}
if r0.SourceName != "O*NET Web Services" {
t.Errorf("recs[0]: want SourceName %q, got %q", "O*NET Web Services", r0.SourceName)
}
// SourceRecordID is the global onet:<elementID> key, occupation independent.
wantID0 := "onet:2.A.1.b"
if r0.SourceRecordID != wantID0 {
t.Errorf("recs[0]: want SourceRecordID %q, got %q", wantID0, r0.SourceRecordID)
}
if r0.Code != "2.A.1.b" {
t.Errorf("recs[0]: want Code %q, got %q", "2.A.1.b", r0.Code)
}
if r0.Term != "Active Listening" {
t.Errorf("recs[0]: want Term %q, got %q", "Active Listening", r0.Term)
}
if r0.Category != "skill" {
t.Errorf("recs[0]: want Category %q, got %q", "skill", r0.Category)
}
// Second element: 2.A.1.a / Reading Comprehension
r1 := recs[1]
if r1.SourceRecordID != "onet:2.A.1.a" {
t.Errorf("recs[1]: want SourceRecordID %q, got %q", "onet:2.A.1.a", r1.SourceRecordID)
}
if r1.Code != "2.A.1.a" {
t.Errorf("recs[1]: want Code %q, got %q", "2.A.1.a", r1.Code)
}
if r1.Term != "Reading Comprehension" {
t.Errorf("recs[1]: want Term %q, got %q", "Reading Comprehension", r1.Term)
}
}
// TestParseONETTechSkills feeds the documented technology_skills fixture to parseONETTechSkills
// and confirms it yields one KindSkill VocabRecord per example title with the correct
// SourceRecordID ("onet-tech:" plus the lowercased title), Term, and Category.
func TestParseONETTechSkills(t *testing.T) {
recs, err := parseONETTechSkills([]byte(onetTechSkillsFixture), "15-1252.00")
if err != nil {
t.Fatalf("parseONETTechSkills returned an error: %v", err)
}
// Fixture has 2 examples in first category + 1 in second = 3 total.
if len(recs) != 3 {
t.Fatalf("want 3 records, got %d", len(recs))
}
// First example: Apache Kafka, category Development environment software.
r0 := recs[0]
if r0.Kind != ontology.KindSkill {
t.Errorf("recs[0]: want Kind %q, got %q", ontology.KindSkill, r0.Kind)
}
if r0.SourceName != "O*NET Web Services" {
t.Errorf("recs[0]: want SourceName %q, got %q", "O*NET Web Services", r0.SourceName)
}
wantID0 := "onet-tech:apache kafka"
if r0.SourceRecordID != wantID0 {
t.Errorf("recs[0]: want SourceRecordID %q, got %q", wantID0, r0.SourceRecordID)
}
if r0.Term != "Apache Kafka" {
t.Errorf("recs[0]: want Term %q, got %q", "Apache Kafka", r0.Term)
}
if r0.Category != "Development environment software" {
t.Errorf("recs[0]: want Category %q, got %q", "Development environment software", r0.Category)
}
if r0.Code != "" {
t.Errorf("recs[0]: want Code empty, got %q", r0.Code)
}
// Second example: Microsoft Visual Studio, same category.
r1 := recs[1]
if r1.SourceRecordID != "onet-tech:microsoft visual studio" {
t.Errorf("recs[1]: want SourceRecordID %q, got %q", "onet-tech:microsoft visual studio", r1.SourceRecordID)
}
if r1.Term != "Microsoft Visual Studio" {
t.Errorf("recs[1]: want Term %q, got %q", "Microsoft Visual Studio", r1.Term)
}
if r1.Category != "Development environment software" {
t.Errorf("recs[1]: want Category %q, got %q", "Development environment software", r1.Category)
}
// Third example: Go, second category.
r2 := recs[2]
if r2.SourceRecordID != "onet-tech:go" {
t.Errorf("recs[2]: want SourceRecordID %q, got %q", "onet-tech:go", r2.SourceRecordID)
}
if r2.Term != "Go" {
t.Errorf("recs[2]: want Term %q, got %q", "Go", r2.Term)
}
if r2.Category != "Object or component oriented development software" {
t.Errorf("recs[2]: want Category %q, got %q", "Object or component oriented development software", r2.Category)
}
}
// TestParseONETOccupations feeds the documented occupations list fixture to parseONETOccupations
// and confirms it returns the expected SOC codes and titles.
func TestParseONETOccupations(t *testing.T) {
codes, err := parseONETOccupations([]byte(onetOccupationsFixture))
if err != nil {
t.Fatalf("parseONETOccupations returned an error: %v", err)
}
if len(codes) != 2 {
t.Fatalf("want 2 codes, got %d", len(codes))
}
if codes[0] != "17-2051.00" {
t.Errorf("codes[0]: want %q, got %q", "17-2051.00", codes[0])
}
if codes[1] != "15-1252.00" {
t.Errorf("codes[1]: want %q, got %q", "15-1252.00", codes[1])
}
}
// TestParseONETElementEmpty confirms parseONETElement handles an empty element array gracefully.
func TestParseONETElementEmpty(t *testing.T) {
empty := `{"start":1,"end":0,"total":0,"element":[]}`
recs, err := parseONETElement([]byte(empty), "17-2051.00", "skill", ontology.KindSkill)
if err != nil {
t.Fatalf("parseONETElement on empty array returned error: %v", err)
}
if len(recs) != 0 {
t.Fatalf("want 0 records for empty array, got %d", len(recs))
}
}
// TestParseONETTechSkillsEmpty confirms parseONETTechSkills handles an empty category array gracefully.
func TestParseONETTechSkillsEmpty(t *testing.T) {
empty := `{"start":1,"end":0,"total":0,"category":[]}`
recs, err := parseONETTechSkills([]byte(empty), "17-2051.00")
if err != nil {
t.Fatalf("parseONETTechSkills on empty array returned error: %v", err)
}
if len(recs) != 0 {
t.Fatalf("want 0 records for empty array, got %d", len(recs))
}
}
// TestONETSourceName confirms the Name method returns the expected provenance label.
func TestONETSourceName(t *testing.T) {
src := NewONETSource("testkey", nil)
if src.Name() != "O*NET Web Services" {
t.Errorf("want Name %q, got %q", "O*NET Web Services", src.Name())
}
}
// TestONETErrThrottledSentinel confirms ErrThrottled is the error returned on a 429. This test
// does not call the live API; it uses errors.Is to verify the sentinel identity.
func TestONETErrThrottledSentinel(t *testing.T) {
if !errors.Is(ontology.ErrThrottled, ontology.ErrThrottled) {
t.Error("ontology.ErrThrottled does not satisfy errors.Is with itself")
}
}