test_that("WHO URL builder is deterministic and configurable", { u <- who_odata_url("WHOSIS_000001", filter = "SpatialDim eq 'IRN'", top = 100) expect_match(u, "ghoapi.azureedge.net/api/WHOSIS_000001", fixed = TRUE) expect_match(u, "SpatialDim", fixed = TRUE) expect_match(u, "100", fixed = TRUE) u2 <- who_odata_url("Indicator", base_url = "https://example.org/odata") expect_match(u2, "https://example.org/odata/Indicator", fixed = TRUE) }) test_that("WHO fixture-like rows map to canonical provider data", { raw <- data.frame( IndicatorCode = "WHOSIS_000001", SpatialDim = "IRN", TimeDim = 2024, NumericValue = 72.4, Value = "72.4 years", stringsAsFactors = FALSE ) x <- AI4OfficialStats:::.sf_who_to_provider(raw, "WHOSIS_000001", "fixture://who") expect_s3_class(x, "stat_provider_data") expect_equal(x$.indicator_code, "WHOSIS_000001") expect_equal(x$.geo, "IRN") expect_equal(x$.time, "2024") expect_equal(x$.value, 72.4) expect_equal(x$.unit, "years") })