importSwiftUIimport XCTest@testable importCottonUIfinalclassThemeRecordWinsTests: XCTestCase {/// RULE: a theme value read from the database's theme record overrides the/// app's constant — a palette role, a paper's dye, a size — so the look is/// data and the Swift values are only the fallback for what a row leaves out.func testAValueInTheThemeRecordOverridesTheConstant() throws {let row = ##"{"id":"database","family":"paper","palette":{"light":{"ground":"#123456","dyes":{"sage":"#102030"}}},"scale":{"tokens":{"title_size":21}}}"##let theme = Theme.decode(Data(row.utf8)) XCTAssertEqual(theme.palette.light.ground, ThemeColor(hex: "#123456")) XCTAssertEqual(theme.palette.light.dyes[.sage], ThemeColor(hex: "#102030")) XCTAssertEqual(theme.palette.light.dyes[.cream], Theme.paper.palette.light.dyes[.cream], "a dye the row leaves out is the shipped theme's") XCTAssertEqual(theme.scale.titleSize, 21) XCTAssertEqual(theme.palette.light.inkBody, Theme.paper.palette.light.inkBody, "what the row leaves out is the constant") }}