test_that("get.fits extracts fitted distributions from smooth.roc object",{

  skip_if_not_installed("pROC")
  library(pROC)

  data(blood_data)

  roc_obj<-roc(
    blood_data,
    response="Diagnosis",
    predictor="NfL",
    quiet=TRUE
  )

  fits<-find.distr(roc_obj, quiet=TRUE)

  smooth_roc<-do.call(
    smooth,
    c(list(roc_obj, method="fitdistr"), fits)
  )

  extracted<-get.fits(smooth_roc)

  expect_s3_class(extracted, "roc.fits")
  expect_named(extracted, c("controls", "cases"))

  expect_named(
    extracted$controls,
    c("distribution", "parameters", "aic")
  )

  expect_named(
    extracted$cases,
    c("distribution", "parameters", "aic")
  )

  expect_true(is.numeric(extracted$controls$aic))
  expect_true(is.numeric(extracted$cases$aic))
})

