Skip to content
Merged
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
11 changes: 3 additions & 8 deletions Tests/AckGenTests/AcknowledgementAllTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ import XCTest

final class AcknowledgementAllTests: XCTestCase {

/// Helper to load acknowledgements from the Fixtures subdirectory
private func loadAcknowledgementsFromFixture(plistName: String) -> [Acknowledgement] {
return Acknowledgement.all(fromPlist: "Fixtures/\(plistName)", in: Bundle.module)
}

func testAllDecodesFixturePlist() {
// Given: A fixture plist in the test bundle's Fixtures directory
// When: Loading acknowledgements from the fixture
let acks = loadAcknowledgementsFromFixture(plistName: "Acknowledgements")
let acks = Acknowledgement.all(fromPlist: "Fixtures/Acknowledgements", in: Bundle.module)

// Then: All entries should be decoded correctly
XCTAssertEqual(acks.count, 3)
Expand All @@ -37,7 +32,7 @@ final class AcknowledgementAllTests: XCTestCase {
func testAllSortsCaseInsensitively() {
// Given: A fixture plist with mixed case titles (Zebra, apple, Banana)
// When: Loading acknowledgements (which applies case-insensitive sorting)
let acks = loadAcknowledgementsFromFixture(plistName: "Acknowledgements")
let acks = Acknowledgement.all(fromPlist: "Fixtures/Acknowledgements", in: Bundle.module)

// Then: Should be sorted case-insensitively: apple, Banana, Zebra
XCTAssertEqual(acks.count, 3)
Expand All @@ -63,7 +58,7 @@ final class AcknowledgementAllTests: XCTestCase {
// The all() method should return empty array for any decode failure

// When: Attempting to decode a plist with invalid UTF-8 content
let acks = loadAcknowledgementsFromFixture(plistName: "invalid-utf8-license")
let acks = Acknowledgement.all(fromPlist: "Fixtures/invalid-utf8-license", in: Bundle.module)

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