#Test that rcatfish_updates returns proper information


test_that("Test that rcatfish_updates returns proper definitions",{
  updates.hit <-try(rcatfish_updates())
  if ("try-error"%in%class(updates.hit)) {
    skip("could not connect to remote database")
    }else{
      expect_in(names(updates.hit), c("UpdateDate", "Changes", "AuthorshipChanges","AddedGenera", "AddedSpecies", "SpellingChanges"))#Check names are correct
      has_valid_date <- grepl("Updated on \\d{1,2} [a-zA-Z.]+[[:space:]]\\d{4}", updates.hit$UpdateDate)#Check it say update and has month and year
      if (!has_valid_date) {
        skip("Skipping test: Update date does not match the expected date pattern")
      }
      expect_true(has_valid_date)
    }
  }
)
