Cotton code
18 lines · 913 B · SwiftRaw
import CottonKitimport Foundationimport XCTest@testable import CottonUI/// A tool's page under the ring (lane ring2): one list of the view its ring/// chose, its views and their heads as the core answers them (`shell.fan`).@MainActorfinal class ToolViewPageTests: XCTestCase {    /// RULE: a view's head is the core's line (`shell.fan`), drawn over its deck as said: Finished's "2 of 24 this year"; a view with none has none.    func testAViewsHeadIsTheCoresLine() throws {        let finished = try JSONDecoder().decode(ToolView.self, from: Data(#"{"id":"finished","label":"Finished","count":2,"head":"2 of 24 this year","read":{"table":"book"}}"#.utf8))        XCTAssertEqual(finished.head, "2 of 24 this year")        let reading = try JSONDecoder().decode(ToolView.self, from: Data(#"{"id":"reading","label":"Reading","read":{"table":"book"}}"#.utf8))        XCTAssertNil(reading.head)    }}