test_that("NRSI calculation works with dummy data", { # Create dummy data fish_data <- data.frame( trophic_level_f = rep(c("2-2.5", "3-3.5", "4-4.5"), each = 3), year = rep(2020, 9), region = rep("Test Region", 9), reef = rep("Test Reef", 9), protection = rep("Not Protected", 9), latitude = rep(20.5, 9), longitude = rep(-100.5, 9), depth2 = rep(10, 9), transect = rep(1:3, 3), biomass = c(100, 150, 200, 300, 350, 400, 50, 60, 70) ) # Calculate NRSI result <- calculate_nrsi(fish_data) # Test structure expect_s3_class(result, "data.frame") expect_true("nrsi" %in% names(result)) # Test calculation expect_true(all(result$nrsi >= -1 & result$nrsi <= 1)) })