From 0189c4690de7e5a16cfdc815083ccf69eaa0075e Mon Sep 17 00:00:00 2001 From: Philip Bulsink Date: Mon, 22 Sep 2025 21:16:03 -0400 Subject: [PATCH 1/2] Update test-plot_fastest to reflect ggplot2 4.0.0 changes #292 --- tests/testthat/test-plot_fastest.R | 10 +++++----- tests/testthat/test-utils.R | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-plot_fastest.R b/tests/testthat/test-plot_fastest.R index 79ef6c8..04b4f67 100644 --- a/tests/testthat/test-plot_fastest.R +++ b/tests/testthat/test-plot_fastest.R @@ -47,15 +47,15 @@ test_that("graphics work", { qualiplot <- plot_fastest(2023, 1, "Q", "HAM", "gear") }) }) - expect_equal(gear$label$title, speed$label$title) - expect_equal(gear$label$caption, "Generated by {f1dataR} package") - expect_true(grepl("Lewis Hamilton Fastest Lap", gear$label$subtitle)) + expect_equal(ggplot2::get_labs(gear)$title, ggplot2::get_labs(speed)$title) + expect_equal(ggplot2::get_labs(gear)$caption, "Generated by {f1dataR} package") + expect_true(grepl("Lewis Hamilton Fastest Lap", ggplot2::get_labs(gear)$subtitle)) - expect_equal(qualiplot$label$title, "2023 Bahrain Grand Prix Qualifying") + expect_equal(ggplot2::get_labs(qualiplot)$title, "2023 Bahrain Grand Prix Qualifying") qp_axis <- qualiplot + theme_dark_f1(axis_marks = TRUE) - expect_equal(qp_axis$labels, qualiplot$labels) + expect_equal(ggplot2::get_labs(qp_axis), ggplot2::get_labs(qualiplot)) }) test_that("correct_track_ratio works", { diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index f7391bf..7a5c399 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -14,7 +14,7 @@ test_that("utility functions work", { # get_jolpica_content() is inherently tested in load_x functions too url <- "2022/circuits.json?limit=40" - expect_warning(get_ergast_content(url), regexp = "was deprecated in f1dataR") + suppressWarnings(expect_warning(get_ergast_content(url), regexp = "was deprecated in f1dataR")) # Test for ergast deprecation # Test add_col_if_absent() From ad3828be88e83d0aee52873302d5b9d4e12ba2e4 Mon Sep 17 00:00:00 2001 From: Philip Bulsink Date: Mon, 22 Sep 2025 21:17:18 -0400 Subject: [PATCH 2/2] Update NEWS.md --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index 327807b..a2e798f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # f1dataR (development version) * Fixed a data conversion issue in `time_to_sec()` (#290) +* Updated testing to comply with changes in ggplot2 (#292) # f1dataR 2.0.1