11import { act , render , screen } from '@testing-library/react' ;
22import type { CSSProperties } from 'react' ;
33import { beforeEach , describe , expect , it , vi } from 'vitest' ;
4+ import { Position } from 'reactflow' ;
45import type { DesignSystem } from '@/lib/types' ;
56import { DEFAULT_DESIGN_SYSTEM , useFlowStore } from '@/store' ;
67import CustomNode from './CustomNode' ;
@@ -77,16 +78,12 @@ describe('Design System integration', () => {
7778 const altSystem = createSystem ( {
7879 id : 'alt' ,
7980 name : 'Alt' ,
80- colors : {
81- nodeBackground : '#101820' ,
82- nodeBorder : '#00d1ff' ,
83- nodeText : '#f6f7f9' ,
84- edge : '#ff0055' ,
85- } ,
86- components : {
87- edge : { strokeWidth : 6 } ,
88- } ,
8981 } ) ;
82+ altSystem . colors . nodeBackground = '#101820' ;
83+ altSystem . colors . nodeBorder = '#00d1ff' ;
84+ altSystem . colors . nodeText = '#f6f7f9' ;
85+ altSystem . colors . edge = '#ff0055' ;
86+ altSystem . components . edge . strokeWidth = 6 ;
9087
9188 useFlowStore . setState ( {
9289 designSystems : [ defaultSystem , altSystem ] ,
@@ -103,30 +100,24 @@ describe('Design System integration', () => {
103100 dragging = { false }
104101 zIndex = { 1 }
105102 data = { { label : 'Node A' } }
106- positionAbsoluteX = { 0 }
107- positionAbsoluteY = { 0 }
108103 isConnectable = { true }
109104 xPos = { 0 }
110105 yPos = { 0 }
111- sourcePosition = "right"
112- targetPosition = "left"
106+ sourcePosition = { Position . Right }
107+ targetPosition = { Position . Left }
113108 />
114109 ) ;
115110
116111 const nodeContainer = screen . getByTestId ( 'custom-node-container' ) ;
117- expect ( nodeContainer ) . toHaveStyle ( {
118- backgroundColor : '#ffffff' ,
119- borderColor : '#e2e8f0' ,
120- } ) ;
112+ expect ( nodeContainer . style . backgroundColor ) . toBe ( 'rgb(255, 255, 255)' ) ;
113+ expect ( nodeContainer . style . borderColor ) . toBe ( 'rgb(226, 232, 240)' ) ;
121114
122115 act ( ( ) => {
123116 useFlowStore . getState ( ) . setActiveDesignSystem ( 'alt' ) ;
124117 } ) ;
125118
126- expect ( nodeContainer ) . toHaveStyle ( {
127- backgroundColor : '#101820' ,
128- borderColor : '#00d1ff' ,
129- } ) ;
119+ expect ( nodeContainer . style . backgroundColor ) . toBe ( 'rgb(16, 24, 32)' ) ;
120+ expect ( nodeContainer . style . borderColor ) . toBe ( 'rgb(0, 209, 255)' ) ;
130121 } ) ;
131122
132123 it ( 'updates edge visual tokens when active design system changes' , ( ) => {
@@ -139,8 +130,8 @@ describe('Design System integration', () => {
139130 sourceY = { 0 }
140131 targetX = { 100 }
141132 targetY = { 100 }
142- sourcePosition = "right"
143- targetPosition = "left"
133+ sourcePosition = { Position . Right }
134+ targetPosition = { Position . Left }
144135 selected = { false }
145136 style = { { } }
146137 />
@@ -163,8 +154,8 @@ describe('Design System integration', () => {
163154 sourceY = { 0 }
164155 targetX = { 100 }
165156 targetY = { 100 }
166- sourcePosition = "right"
167- targetPosition = "left"
157+ sourcePosition = { Position . Right }
158+ targetPosition = { Position . Left }
168159 selected = { false }
169160 style = { { } }
170161 />
0 commit comments