Error: connection to server at "localhost" (::1), port 5432 failed: Connection refused (0x0000274D/10061)
	Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused (0x0000274D/10061)
	Is the server running on that host and accepting TCP/IP connections?

test_that("get_species_names returns a character vector", {
expect_true("Rubus buergeri Miq." %in% species)
test_that("get_variable_names returns a character vector", {
test_that("get_table_names returns a character vector", {
test_that("get_data returns a data frame for valid inputs", {
species_data <- get_data("Rubus buergeri Miq.", c("orders", "0700_Fuels2", "genus", "species"))
expect_true(all(c("orders", "0700_Fuels2", "genus", "species") %in% names(species_data)))
test_that("get_data returns NULL for invalid species", {
species_data <- get_data("Invalid species", c("orders", "0700_Fuels2", "genus", "species"))
#test_that("get_data handles empty species vector", {
#  species_data <- get_data(character(0), c("orders", "0700_Fuels2", "genus", "species"))
#expect_true(any(grepl("Species vector cannot be empty.", output)))
test_that("get_species_details retrieves correct details for a single species", {
test_that("get_species_details retrieves correct details for multiple species", {
species_names <- c("Dahlia coccinea Cav.", "Acacia auriculiformis Benth.")
test_that("get_species_details handles invalid input types", {
expect_error(get_species_details(123), "species_name should be character or list of characters")
test_that("visualize_native_range creates a plot for given species", {
# Print class of the plot object to debug
# Tests for plot_species_on_map function
test_that("plot_species_on_map creates a plot for given species", {
test_that("plot_species_on_map handles custom colors", {
custom_colors <- list("Dahlia coccinea Cav." = "red")
plot <- plot_species_on_map(species_names, custom_colors = custom_colors)
test_that("plot_species_on_map returns error for invalid custom colors input", {
expect_error(plot_species_on_map(species_names, custom_colors = custom_colors), "custom_colors must be a list when specifying custom colors.")
test_that("bar_plot has correct title and labels", {
expect_match(plot$labels$title, "Number of Species for Each Invasion Status Category")
test_that("species_count_plot creates ggplot objects", {
test_that("species_count_plot has correct titles and labels", {
# Check titles and labels for growth habit plot
expect_match(plots$plot_growthhabit$labels$title, "Number of Species for Each Growth Habit Category")
# Check titles and labels for duration plot
expect_match(plots$plot_duration$labels$title, "Number of Species for Each Duration Category")
# Tests for introduction_pathways_plot function
test_that("introduction_pathways_plot creates a Plotly pie chart", {