From 833868e3f75d442e9a734e79087f04cbdbc8fb69 Mon Sep 17 00:00:00 2001 From: Joshua Lambert Date: Fri, 20 Sep 2024 14:55:43 +0100 Subject: [PATCH] add test for lnorm median and dispersion conversion --- tests/testthat/_snaps/convert_params.md | 25 +++++++++++++++++++++++++ tests/testthat/test-convert_params.R | 4 ++++ 2 files changed, 29 insertions(+) diff --git a/tests/testthat/_snaps/convert_params.md b/tests/testthat/_snaps/convert_params.md index 825b95af1..4a9395fc4 100644 --- a/tests/testthat/_snaps/convert_params.md +++ b/tests/testthat/_snaps/convert_params.md @@ -73,6 +73,31 @@ ] } +--- + + { + "type": "list", + "attributes": { + "names": { + "type": "character", + "attributes": {}, + "value": ["meanlog", "sdlog"] + } + }, + "value": [ + { + "type": "double", + "attributes": {}, + "value": [1.60943791] + }, + { + "type": "double", + "attributes": {}, + "value": [0.69314718] + } + ] + } + --- { diff --git a/tests/testthat/test-convert_params.R b/tests/testthat/test-convert_params.R index b37e0a820..f968dfad4 100644 --- a/tests/testthat/test-convert_params.R +++ b/tests/testthat/test-convert_params.R @@ -23,6 +23,10 @@ test_that("convert_summary_stats_to_params.character works as expected", { convert_summary_stats_to_params("lnorm", median = 1, sd = 1), style = "json2" ) + expect_snapshot_value( + convert_summary_stats_to_params("lnorm", median = 5, dispersion = 2), + style = "json2" + ) expect_snapshot_value( convert_summary_stats_to_params("nbinom", mean = 1, dispersion = 1), style = "json2"