@@ -4,12 +4,12 @@ import type { AmuseTopLevel } from "../src/amuseJSONToXD.types"
44import { beforeAll , describe , expect , it } from "vitest"
55import { rebusAmuseExample , schrodingerAmuseExample } from "./amuse/amuseExamples"
66
7- const exampleJSONPath = "/Users/orta/dev/workshop/packages/amuse-to-xd/examples/2024_03_17-barred_cryptic.json"
7+ const exampleJSONPath = "/Users/orta/dev/old- workshop/packages/amuse-to-xd/examples/2024_03_17-barred_cryptic.json"
88const fullExamplePath = exampleJSONPath
99
10- const hasCirclesPath = "/Users/orta/dev/workshop/packages/amuse-to-xd/examples/2025_04_01-themed.json"
11- const largeGrid = "/Users/orta/dev/workshop/packages/amuse-to-xd/examples/2021_01_01-oversize.json"
12- const cartoon = "/Users/orta/dev/workshop/packages/amuse-to-xd/examples/2019_12_23-cartoon.json"
10+ const hasCirclesPath = "/Users/orta/dev/old- workshop/packages/amuse-to-xd/examples/2025_04_01-themed.json"
11+ const largeGrid = "/Users/orta/dev/old- workshop/packages/amuse-to-xd/examples/2021_01_01-oversize.json"
12+ const cartoon = "/Users/orta/dev/old- workshop/packages/amuse-to-xd/examples/2019_12_23-cartoon.json"
1313
1414// Only run tests if the example JSON files exist
1515const shouldRunTests = existsSync ( fullExamplePath ) && existsSync ( hasCirclesPath )
@@ -614,5 +614,26 @@ describeConditional("amuseJSONToXD", () => {
614614 expect ( a1Clue ?. body ) . toEqual ( "Hairdo" )
615615 expect ( a1Clue ?. answer ) . toEqual ( "COIF" )
616616 } )
617+
618+ it ( "handles linked clues with refs metadata" , ( ) => {
619+ const xdOutput = convertAmuseToCrosswordJSON ( JSON . parse ( readFileSync ( largeGrid , "utf-8" ) ) )
620+
621+ // Look for clues with refs metadata (linked clues)
622+ const allClues = [ ...xdOutput . clues . across , ...xdOutput . clues . down ]
623+ const cluesWithRefs = allClues . filter ( ( clue ) => clue . metadata ?. refs )
624+
625+ expect ( cluesWithRefs . map ( ( c ) => [ c . body , c . metadata ?. refs ] as const ) . sort ( ( a , b ) => a [ 0 ] . localeCompare ( b [ 0 ] ) ) ) . toMatchInlineSnapshot ( `
626+ [
627+ [
628+ "See 54-Across",
629+ "A54",
630+ ],
631+ [
632+ "With 44-Across, Middle Eastern body of water",
633+ "A44",
634+ ],
635+ ]
636+ ` )
637+ } )
617638 } )
618639} )
0 commit comments