R Under development (unstable) (2025-04-24 r88177 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # This file is part of the standard setup for testthat. > # It is recommended that you do not modify it. > # > # Where should you do additional test configuration? > # Learn more about the roles of various files in: > # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview > # * https://testthat.r-lib.org/articles/special-files.html > > library(testthat) > library(Rmoji) > library(mockery) > library(shiny) > > test_that("insert_emoji returns correct emoji for valid keyword", { + mockery::stub(insert_emoji, "rstudioapi::insertText", function(text) NULL) + expect_equal(insert_emoji("smile"), "😄") + expect_equal(insert_emoji("heart"), "❤️") + }) Test passed 😀 > > test_that("insert_emoji handles unknown keywords gracefully", { + mockery::stub(insert_emoji, "rstudioapi::insertText", function(text) NULL) + expect_equal(insert_emoji("unknown_keyword", default = "❓"), "❓") + }) Test passed 🌈 > > test_that("insert_emoji handles case-insensitive input", { + mockery::stub(insert_emoji, "rstudioapi::insertText", function(text) NULL) + expect_equal(insert_emoji("Smile"), "😄") + expect_equal(insert_emoji("HEART"), "❤️") + }) Test passed 🥳 > > test_that("insert_emoji throws error when no default provided", { + mockery::stub(insert_emoji, "rstudioapi::insertText", function(text) NULL) + expect_error(insert_emoji("nonexistent")) + }) Test passed 😀 > > test_that("insert_emoji_addin returns correct emoji for valid input", { + expect_equal(insert_emoji_addin("smile"), "😄") + expect_equal(insert_emoji_addin("heart"), "❤️") + }) Test passed 🥇 > > test_that("insert_emoji_addin returns NULL for invalid input", { + expect_null(insert_emoji_addin("not_a_real_emoji")) + expect_null(insert_emoji_addin("")) + }) Test passed 😸 > > proc.time() user system elapsed 1.71 0.32 2.03