From 65c5daede7e8eac0612239142c1c3e0b75d20bd2 Mon Sep 17 00:00:00 2001 From: DivadNojnarg Date: Thu, 23 May 2024 21:17:15 +0200 Subject: [PATCH] fix test --- inst/examples/login/app.R | 6 +++++- tests/testthat/_snaps/f7Login/login-app-001.new.json | 7 +++++++ tests/testthat/_snaps/f7Login/login-app-002.new.json | 7 +++++++ tests/testthat/test-f7Login.R | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/_snaps/f7Login/login-app-001.new.json create mode 100644 tests/testthat/_snaps/f7Login/login-app-002.new.json diff --git a/inst/examples/login/app.R b/inst/examples/login/app.R index a9544032..172b072c 100644 --- a/inst/examples/login/app.R +++ b/inst/examples/login/app.R @@ -24,7 +24,11 @@ app <- shinyApp( server = function(input, output, session) { loginData <- f7LoginServer(id = "login") - exportTestValues(res = loginData) + exportTestValues( + status = loginData$status(), + user = loginData$user(), + password = loginData$password() + ) output$user <- renderText({ req(loginData$user) diff --git a/tests/testthat/_snaps/f7Login/login-app-001.new.json b/tests/testthat/_snaps/f7Login/login-app-001.new.json new file mode 100644 index 00000000..f50480df --- /dev/null +++ b/tests/testthat/_snaps/f7Login/login-app-001.new.json @@ -0,0 +1,7 @@ +{ + "export": { + "password": "", + "status": true, + "user": "" + } +} diff --git a/tests/testthat/_snaps/f7Login/login-app-002.new.json b/tests/testthat/_snaps/f7Login/login-app-002.new.json new file mode 100644 index 00000000..f38991ff --- /dev/null +++ b/tests/testthat/_snaps/f7Login/login-app-002.new.json @@ -0,0 +1,7 @@ +{ + "export": { + "password": "pwd", + "status": false, + "user": "usr" + } +} diff --git a/tests/testthat/test-f7Login.R b/tests/testthat/test-f7Login.R index 8eb9607a..bc0eb03f 100644 --- a/tests/testthat/test-f7Login.R +++ b/tests/testthat/test-f7Login.R @@ -9,12 +9,12 @@ test_that("login works", { name = "login-app" ) - app$expect_values(input = "login", export = "res") + app$expect_values(input = "login", export = TRUE) app$set_inputs("login-user" = "usr", "login-password" = "pwd") app$wait_for_idle(2000) # Wait for any animation to complete app$click(selector = "#login-submit") app$wait_for_idle(2000) - app$expect_values(input = "login", export = "res") + app$expect_values(input = "login", export = TRUE) })