Skip to content

Commit

Permalink
Set layout constants
Browse files Browse the repository at this point in the history
  • Loading branch information
stuart-bradley committed Feb 21, 2024
1 parent 218b352 commit b5f3248
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ export const LAYOUT_PROPS: {
origin: { x: number; y: number };
};
} = {
"5,5": { size: { x: 6, y: 6 }, origin: { x: -15, y: 0 } },
"6,7": { size: { x: 6, y: 6 }, origin: { x: -15, y: 0 } },
"7,7": { size: { x: 6, y: 6 }, origin: { x: -15, y: 0 } },
"5,5": { size: { x: 8, y: 8 }, origin: { x: 0, y: 0 } },
"6,7": { size: { x: 7.5, y: 7.5 }, origin: { x: 5, y: 0 } },
"7,7": { size: { x: 7.5, y: 7.5 }, origin: { x: 0, y: 0 } },
"10,7": { size: { x: 6, y: 6 }, origin: { x: -15, y: 0 } },
} as const;

Expand Down
13 changes: 13 additions & 0 deletions src/lib/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ describe("utils.ts", () => {
serialisedBoard: "RST-WBSB-WTDTR-TRWS-BWS",
expected: LAYOUT_PROPS["5,5"],
},
{
serialisedBoard: "SBT-WSDD-BBTRW-BTRWTW-TBSWS-RTRS-RSW",
expected: LAYOUT_PROPS["6,7"],
},
{
serialisedBoard: "RBWR-RBGTO-WSWOBS-RSOSWGT-RSOTWT-TBODD-BDOO",
expected: LAYOUT_PROPS["7,7"],
},
{
serialisedBoard:
"SGORSOG-GRDDWDSD-SGDSBOBRO-RWOTTSRORB-TOBSRWWBO-WOOBOOTT-WBWOOTT",
expected: LAYOUT_PROPS["10,7"],
},
])(
"Test getLayoutProps returns the correct layout ($expected) for each serialized board (#serialisedBoard)",
({ serialisedBoard, expected }) => {
Expand Down

0 comments on commit b5f3248

Please sign in to comment.