Hi all, I refering the link Shiny - Server function testing with Shiny where I am testing the code in server functions. But i am getting error as shown below
app <- shinyApp(
ui = fluidPage(
numericInput("x", "X", value = 5),
textOutput("txt")
),
server = function(input, output, session) {
myreactive <- reactive({
input$x * 2
})
output$txt <- renderText({
paste0("I am ", myreactive())
})
}
)
testServer(server, {
session$setInputs(x = 1)
expect_equal(myreactive(), 2)
})
Error
shiny::runApp()
Loading required package: shiny
Warning in loadSupport(appDir, renv = sharedEnv, globalrenv = NULL) :
Loading R/ subdirectory for Shiny application, but this directory appears to contain an R package. Sourcing files in R/ may cause unexpected behavior.
Error in isModuleServer(app) : object 'server' not found
Can anyone help me here