From 873e8d650d93327727f9ae75f7686f558329cbba Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Thu, 23 Nov 2023 12:09:09 +0000 Subject: [PATCH] [tests] Verify that erase deletes snapshot file --- tests/test_base_snapshot.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_base_snapshot.cpp b/tests/test_base_snapshot.cpp index 950747d3c95..70b4f61ce09 100644 --- a/tests/test_base_snapshot.cpp +++ b/tests/test_base_snapshot.cpp @@ -582,4 +582,16 @@ TEST_F(TestBaseSnapshot, eraseCallsImpl) snapshot.erase(); } +TEST_F(TestBaseSnapshot, eraseRemovesJSON) +{ + MockBaseSnapshot snapshot{"House of Mojo", "voodoo", nullptr, specs, vm}; + snapshot.capture(); + + const auto expected_filename = derive_persisted_snapshot_filename(snapshot.get_index()); + ASSERT_TRUE(QFileInfo{expected_filename}.exists()); + + snapshot.erase(); + EXPECT_FALSE(QFileInfo{expected_filename}.exists()); +} + } // namespace