importCottonKitimportFoundationimport XCTest@testable importCottonUI/// What waits in the Bin can be brought back from where it was deleted.finalclassBinShelfTests: XCTestCase {privatefunc definitions() throws -> [TableDefinition] {let bundle = try XCTUnwrap(Bundle(url: SourceSweep.iosSources.appendingPathComponent("CottonUI/Resources")))let loaded = FixtureDefinitions.load(from: bundle) XCTAssertEqual(loaded.failures, [])return loaded.definitions }/// RULE: Every table whose delete waits in the bin offers the way back on/// its own list: a Deleted link to the bin narrowed to that table. A table/// that starts binning its deletes (Money, 6afc7633b) owes the link in the/// same landing, or its deleted rows wait somewhere nobody is sent.func testEveryBinnedTableLinksToItsDeleted() throws {let binned = try definitions().filter { $0.deletion?.bin == true } XCTAssertFalse(binned.isEmpty)for table in binned {let link = table.links.first { $0.table == "bin" } XCTAssertNotNil(link, "\(table.id) has no Deleted link to the bin")let names: [String]switch link?.where["table"] {case .text(let one): names = [one]case .list(let several): names = several.compactMap(\.text)default: names = [] } XCTAssertFalse(names.isEmpty, "\(table.id)'s Deleted link is not narrowed to its own records") } }}