animint / animint2

Animated interactive grammar of graphics
https://animint.github.io/animint2/
63 stars 21 forks source link

Hard test(gsoc)-->Error getting while going unittest #173

Open busttech opened 1 day ago

busttech commented 1 day ago

code

library(testthat)
library(animint2)

test_that("Animint renderer test works", {
  # Create a simple Animint object
  viz <- animint(
    data = data.frame(x = 1:10, y = rnorm(10)),
    aes(x = x, y = y),
    geom = "point"
  )

  # Use animint2HTML to render the visualization to a temporary directory
  temp_dir <- tempdir()
  output <- animint2HTML(viz, out.dir = temp_dir)

  # Check if the output HTML file exists
  expect_true(file.exists(file.path(temp_dir, "index.html")), 
              "HTML file was not created.")

  # Optionally: Check the content of the HTML file
  html_content <- readLines(file.path(temp_dir, "index.html"))
  expect_true(grepl("d3", html_content[1]), "HTML file does not contain d3.js.")
})

Its showing error Screenshot 2024-12-01 103635 I think problem is that animint2 doesnot have function animint2html and animint is not compatible with my R version can you tell me which version of r require for animint.

ampurr commented 1 day ago

Maybe I'm missing something. But I'm a little confused. If animint2 doesn't have an animint2HTML function, why are you trying to use it? 😮

busttech commented 21 hours ago

I was informed to use animint2Html in the GSoC documentation. Could you please tell me which R version Animint works with? I am very new to this, so to be honest, I have taken references from many previous codes.

ampurr commented 18 hours ago

I'm not familiar with what GSOC is saying: Could you point to where the GSOC document says so? You may also want to take a look at the animint2 documentation, especially at the list of functions. I have some confidence that the solution to your coding woes is in there. 😄

Regarding R version... I guess the latest one? Toby could probably tell you more if it's relevant.

tdhock commented 7 hours ago

did you read this? https://github.com/animint/animint2/wiki/Chromote-testing-documentation