Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/platform/bls/bls_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/platform/bls/bls_test.go |
| Original SHA-256 | 881281102bc9724bb3330c67acb4777f25717045abaa31a1ccb2147415507700 |
| Git blob SHA | ddf17bcf7404a91c19b92cf8885b766ade45a36b |
| Reading-copy SHA-256 | 881281102bc9724bb3330c67acb4777f25717045abaa31a1ccb2147415507700 |
Every recorded occurrence
These 11 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/platform/bls/bls_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | collision-deconfliction | 4ee5a09972608ed89f8377c6665542d5f450f0a6 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | m5-price-to-win | 41000ad30fff4129fdaf5ec84e15ba14c27d4890 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | master | 1e9249840a4302ec82e123b9c9cb6f75badea3e4 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | mag-substrate | b82c7100a492dec67dfd1eda6b3f53def859be35 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | time-to-fill-survival | b66e1e505863d4f17741a4b9ede73509e45bd6c6 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | presentation-readiness | eb574acaa29d71ce4d0f852572e87c275c79fdb7 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | vendor-intelligence | fe9796a19c261951d3f2565206c0c1b5ac294465 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | phase2-connectors | e038d4c687aec16f8bd9bc4d907eea14d91f8704 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
| Janady13/missionmatch / internal/platform/bls/bls_test.go | capture-readiness | bae6af7cb2997e819174a9e9cfff5e16067a1975 | Open original |
Recovered source transcript
Download complete source text ↓84 lines · 3.2 KB
package bls
import (
"context"
"net/http"
"net/http/httptest"
"strings"
"testing"
)
const sampleResp = `{"status":"REQUEST_SUCCEEDED","responseTime":1,"message":[],"Results":{"series":[
{"seriesID":"OEUS150000000000015121204","data":[{"year":"2025","period":"A01","periodName":"Annual","value":"122660"}]},
{"seriesID":"OEUS350000000000015121204","data":[{"year":"2025","period":"A01","periodName":"Annual","value":"142450"}]}
]}}`
func TestFetchLatestMapsValues(t *testing.T) {
var gotKey, gotLatest bool
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body := make([]byte, r.ContentLength)
_, _ = r.Body.Read(body)
s := string(body)
gotKey = strings.Contains(s, "registrationKey")
gotLatest = strings.Contains(s, "\"latest\":true")
_, _ = w.Write([]byte(sampleResp))
}))
defer srv.Close()
c := New("secret", srv.URL)
out, err := c.FetchLatest(context.Background(), []string{"OEUS150000000000015121204", "OEUS350000000000015121204"})
if err != nil {
t.Fatalf("fetch: %v", err)
}
if !gotKey || !gotLatest {
t.Fatalf("request must send registrationKey and latest: key=%v latest=%v", gotKey, gotLatest)
}
if len(out) != 2 || out[0].Value != "122660" || out[0].Year != "2025" {
t.Fatalf("values mapped wrong: %+v", out)
}
}
func TestFetchLatestThreshold(t *testing.T) {
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
_, _ = w.Write([]byte(`{"status":"REQUEST_NOT_PROCESSED","message":["You have exceeded the daily threshold of requests."]}`))
}))
defer srv.Close()
c := New("k", srv.URL)
if _, err := c.FetchLatest(context.Background(), []string{"X"}); err != ErrThrottled {
t.Fatalf("threshold message must map to ErrThrottled, got %v", err)
}
}
func TestGalapagosSeriesShape(t *testing.T) {
specs := GalapagosSeries()
// 5 occupations x 2 areas x 2 metrics
if len(specs) != 20 {
t.Fatalf("want 20 series specs, got %d", len(specs))
}
if specs[0].SeriesID != "OEUS150000000000015121204" {
t.Fatalf("first series id wrong: %s", specs[0].SeriesID)
}
}
// TestNationalSeriesID pins the national OEWS series id builder to the verified format: OEUN + national
// area 0000000 + all industry 000000 + the six digit SOC + the datatype. SOC 151212 datatype 04 (annual
// mean) must build OEUN000000000000015121204, the series that returned 132510 against the live BLS API,
// and datatype 13 (annual median) must build the matching median series.
func TestNationalSeriesID(t *testing.T) {
if got := NationalSeriesID("151212", "04"); got != "OEUN000000000000015121204" {
t.Fatalf("national annual mean series id wrong: got %s want OEUN000000000000015121204", got)
}
if got := NationalSeriesID("151212", "13"); got != "OEUN000000000000015121213" {
t.Fatalf("national annual median series id wrong: got %s want OEUN000000000000015121213", got)
}
// The national prefix is OEUN, never the state prefix OEUS, and the series is exactly 25 characters (the
// verified OEUN000000000000015121204 is 25 characters).
got := NationalSeriesID("113021", "04")
if got[:4] != "OEUN" {
t.Fatalf("national series must carry the OEUN prefix, got %s", got)
}
if len(got) != 25 {
t.Fatalf("a national OEWS series id must be 25 characters, got %d in %s", len(got), got)
}
}