From d3adea51e9524ee89e459b56820bf4831d23e05b Mon Sep 17 00:00:00 2001 From: Jakub Sobolewski Date: Sun, 19 Jan 2025 20:44:49 +0000 Subject: [PATCH] test: :test_tube::x: Add specification for CSV storage - Create a specification for an interface that will connect the app with a CSV file. --- tests/testthat/test-storage.R | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/testthat/test-storage.R diff --git a/tests/testthat/test-storage.R b/tests/testthat/test-storage.R new file mode 100644 index 0000000..ce3d999 --- /dev/null +++ b/tests/testthat/test-storage.R @@ -0,0 +1,24 @@ +box::use( + fs[file_exists], + testthat[...], # nolint + withr[with_tempdir], +) + +box::use( + app / storage, +) + +describe("new", { + it("should create a new csv storage if csv path is provided", { + with_tempdir({ + # Arrange + path <- "store.csv" + + # Act + .storage <- storage$new(path, schema = list(amount = numeric())) + + # Assert + expect_true(file_exists(.storage)) + }) + }) +})