Skip to content

Commit

Permalink
Adding testWritingEmptyDataAndKeys test to DiskStorageEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
YOURNAME authored and YOURNAME committed Oct 17, 2022
1 parent b05a083 commit 3e7c1c5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Tests/BodegaTests/DiskStorageEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ final class DiskStorageEngineTests: XCTestCase {
XCTAssertEqual(Self.storedKeysAndData.map(\.data), readKeysAndObjects.map(\.data))
}

func testWritingEmptyDataAndKeys() async throws {
// This test ensures that writing an empty array does not throw an error as it did in previous versions
try await storage.write([])

let itemCount = await storage.keyCount()
XCTAssertEqual(itemCount, 0)
}

func testReadingDataSucceeds() async throws {
try await storage.write(Self.testData, key: Self.testCacheKey)
let readData = await storage.read(key: Self.testCacheKey)
Expand Down

0 comments on commit 3e7c1c5

Please sign in to comment.