Cotton code
28 lines · 2.1 KB · SwiftRaw
import XCTest@testable import CottonUIfinal class HomeToolRowTests: XCTestCase {    // RULE: The full tool-tile grid, every tool of the database, lives on the Tools screen — Home's grid holds only Home's tiles; the Tools definition must offer that grid (B1).    // RULE: Retired-surface and fixed call-count pins are deleted under the owner's test policy.    // RULE: Tools tiles resolve persisted tool slugs to their photographs, including Storage’s suitcase.    // RULE: The retired tool_order adapter has no page or record verbs to guard.    // RULE: Tool slug mapping preserves literal package images and a table’s default picture.    /// RULE: A data tool's tile draws the photo its row names, with no shipped object to fall back to (the owner's Subscriptions), and a tool with neither a photo nor a shipped object draws the placeholder with its name.    func testADataToolsPhotoIsDrawnAndAToolWithNeitherDrawsItsName() throws {        XCTAssertEqual(ToolObject.drawn(.asset("tool-gauges"), family: .paper) { _ in false }, .typed,                       "an object the app does not ship is the placeholder too")    }    /// RULE: A built-in's picture is a photo record naming the object the app ships, and the device draws that object (its prints, its small variant, offline); a photo the owner set names no object and is drawn from the photo; a data tool's tile draws a picture set on its home table over the one its package carried.    func testAShippedObjectPictureDrawsTheObjectAndADataToolDrawsItsOwnPicture() throws {        let shipped = try JSONDecoder().decode(DefinitionToolPicture.self, from: Data(#"{"photo":"photo:abc","object":"tool-devices"}"#.utf8)).drawn        XCTAssertEqual(shipped, .asset("tool-devices"))        XCTAssertEqual(try JSONDecoder().decode(DefinitionToolPicture.self, from: Data(#"{"photo":"photo:abc"}"#.utf8)).drawn, .photo("photo:abc"))        XCTAssertEqual(try JSONDecoder().decode(DefinitionToolPicture.self, from: Data(#"{"photo":"photo:abc","object":"tool-nothing-shipped"}"#.utf8)).drawn,                       .photo("photo:abc"), "an object the app does not ship is no object")    }}