tests/testthat/test-ai_tool_create_new_file.R

test_that("create_new_file - invalid args", {
  expect_error(create_new_file(list()), "Invalid arguments for CreateNewFile")
})

test_that("create_new_file - new file", {
  local_mocked_bindings(
    documentOpen = function(...) NULL,
    .package = "myownrobs"
  )
  mock_file <- tempfile()
  create_new_file(list(filepath = mock_file, contents = "NEW_FILE_CONTENT"))
  result <- readLines(mock_file)
  expect_equal("NEW_FILE_CONTENT", result)
})

Try the myownrobs package in your browser

Any scripts or data that you put into this service are public.

myownrobs documentation built on Nov. 5, 2025, 5:52 p.m.