11/**
2- * Twin-label vocabulary (graph schema 1.1.0, issue #65): every specific and marker label has a
3- * TS-prefixed twin; the shared merge label `Symbol` deliberately has none (epic #64).
2+ * Twin-label vocabulary (transient dual-labeling on graph schema 2.0.0, issue #65): every specific
3+ * and marker label has a TS-prefixed twin; the shared merge labels (`Symbol`, `CanNode`)
4+ * deliberately have none (epic #64). The v2 catalog merges on `CanNode`, so it is the merge label
5+ * that must stay bare here.
46 */
57import { describe , expect , test } from "bun:test" ;
68import {
@@ -20,25 +22,31 @@ describe("TS twin-label vocabulary", () => {
2022 expect ( twinOf ( "Entrypoint" ) ) . toBe ( "TSEntrypoint" ) ;
2123 } ) ;
2224
23- test ( "withTwins appends a twin per label, keeps order, and skips Symbol " , ( ) => {
25+ test ( "withTwins appends a twin per label, keeps order, and skips shared merge labels " , ( ) => {
2426 expect ( withTwins ( [ "Module" ] ) ) . toEqual ( [ "Module" , "TSModule" ] ) ;
27+ // both shared merge labels are skipped (v2 merges on CanNode)
28+ expect ( withTwins ( [ "CanNode" , "Callable" ] ) ) . toEqual ( [ "CanNode" , "Callable" , "TSCallable" ] ) ;
2529 expect ( withTwins ( [ "Symbol" , "Class" ] ) ) . toEqual ( [ "Symbol" , "Class" , "TSClass" ] ) ;
26- expect ( withTwins ( [ "Symbol " , "Callable" , "Entrypoint" ] ) ) . toEqual ( [
27- "Symbol " , "Callable" , "Entrypoint" , "TSCallable" , "TSEntrypoint" ,
30+ expect ( withTwins ( [ "CanNode " , "Callable" , "Entrypoint" ] ) ) . toEqual ( [
31+ "CanNode " , "Callable" , "Entrypoint" , "TSCallable" , "TSEntrypoint" ,
2832 ] ) ;
2933 // idempotent: an already-expanded set gains nothing
3034 expect ( withTwins ( [ "Module" , "TSModule" ] ) ) . toEqual ( [ "Module" , "TSModule" ] ) ;
3135 } ) ;
3236
33- test ( "schema version is 1.1 .0 (additive MINOR )" , ( ) => {
34- expect ( SCHEMA_VERSION ) . toBe ( "1.1 .0" ) ;
37+ test ( "schema version is 2.0 .0 (v2 catalog )" , ( ) => {
38+ expect ( SCHEMA_VERSION ) . toBe ( "2.0 .0" ) ;
3539 } ) ;
3640
3741 test ( "schema document maps every specific + marker label to its twin" , ( ) => {
3842 const doc = buildSchemaDocument ( ) ;
3943 for ( const n of NODE_LABELS ) expect ( doc . label_twins [ n . label ] ) . toBe ( twinOf ( n . label ) ) ;
4044 for ( const m of MARKER_LABELS ) expect ( doc . label_twins [ m ] ) . toBe ( twinOf ( m ) ) ;
45+ // shared merge labels are never specific/marker labels, so they map to nothing
46+ expect ( doc . label_twins [ "CanNode" ] ) . toBeUndefined ( ) ;
4147 expect ( doc . label_twins [ "Symbol" ] ) . toBeUndefined ( ) ;
48+ // 12 node labels + 1 marker (Entrypoint) = 13 twins
49+ expect ( Object . keys ( doc . label_twins ) . length ) . toBe ( 13 ) ;
4250 expect ( Object . keys ( doc . label_twins ) . length ) . toBe ( NODE_LABELS . length + MARKER_LABELS . length ) ;
4351 } ) ;
4452} ) ;
0 commit comments