Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions Tests/AckGenTests/AcknowledgementAllTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,12 @@ final class AcknowledgementAllTests: XCTestCase {
}

func testAllReturnsEmptyArrayForInvalidPlist() {
// Given: An invalid file (the invalid-utf8-license fixture)
// Given: An invalid plist file (the invalid-utf8-license fixture)
// Note: This test verifies graceful handling of invalid data
// The all() method should return empty array for any decode failure
let bundle = Bundle.module

// When: Loading from a plist that would fail to decode
// (Using Fixtures subdirectory path)
guard let path = bundle.path(forResource: "invalid-utf8-license", ofType: nil, inDirectory: "Fixtures") else {
XCTFail("Could not find invalid-utf8-license fixture")
return
}

// Verify the file exists and contains invalid data
XCTAssertNotNil(FileManager.default.contents(atPath: path))

// When: Attempting to decode as plist, it should fail gracefully
let acks = Acknowledgement.all(fromPlist: "NonExistent", in: bundle)
// When: Attempting to decode a plist with invalid UTF-8 content
let acks = loadAcknowledgementsFromFixture(plistName: "invalid-utf8-license")

// Then: Should return empty array instead of crashing
XCTAssertTrue(acks.isEmpty)
Expand Down