importFoundationimport XCTest@testable importCottonPaper@testable importCottonUIfinalclassThemeScaleKeyTests: XCTestCase {privatefunc shippedRow(_ family: String) throws -> [String: Any] {// The shell's theme row, read by path: the core compiles it in and// the app's catalogue snapshot carries it.let url = SourceSweep.kits.appendingPathComponent("shell/themes/\(family).json")returntry XCTUnwrap(JSONSerialization.jsonObject(with: Data(contentsOf: url)) as? [String: Any]) }/// RULE: the theme the app draws when nothing else is read is its shipped row, whole — every scale knob read from the row, the acts and the cards the row's — never a base of Swift values.func testTheShippedThemeIsItsRow() throws {for (family, theme) in [("paper", Theme.paper), ("plain", Theme.plain)] {let scale = try XCTUnwrap((try shippedRow(family)["scale"] as? [String: Any])?["tokens"] as? [String: Double])for key inThemeScale.Key.allCases { XCTAssertEqual(Double(theme.scale[key]), scale[key.rawValue], "\(family): \(key.rawValue)") } XCTAssertNotEqual(theme.acts, ThemeActs.unread) XCTAssertNotEqual(theme.cards, ThemeCards.unread) } }}