test_that("find.distr returns valid distribution parameters",{

  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)

  expect_type(fits, "list")
  expect_named(
    fits,
    c("density.controls", "density.cases", "start.controls", "start.cases")
  )

  expect_true(is.character(fits$density.controls))
  expect_true(is.character(fits$density.cases))

  expect_true(
    fits$density.controls%in%c("normal", "gamma", "weibull", "lognormal")
  )

  expect_true(
    fits$density.cases%in%c("normal", "gamma", "weibull", "lognormal")
  )
})

test_that("smoothed ROC curve can be generated using find.distr output",{

  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)
  )

  expect_s3_class(smooth_roc, "smooth.roc")
})
