11import { describe , it , expect } from "vitest" ;
22import { createPatchedResultBundle , getDisplayValueForBundle } from "./bundle" ;
33import { createResultScalar } from "./scalar" ;
4- import { MISSING_DISPLAY_VALUE , NBSP } from "@/utils/constants" ;
4+ import { MISSING_DISPLAY_VALUE , ASCII } from "@/utils/constants" ;
55import { createTestableEdge , createTestableVertex } from "@/utils/testing" ;
66
77describe ( "getDisplayValueForBundle" , ( ) => {
@@ -17,7 +17,9 @@ describe("getDisplayValueForBundle", () => {
1717
1818 const result = getDisplayValueForBundle ( bundle ) ;
1919
20- expect ( result ) . toBe ( `Name: John${ NBSP } • Age: 25${ NBSP } • Active: true` ) ;
20+ expect ( result ) . toBe (
21+ `Name: John${ ASCII . NBSP } • Age: 25${ ASCII . NBSP } • Active: true`
22+ ) ;
2123 } ) ;
2224
2325 it ( "should format scalar values without names" , ( ) => {
@@ -31,7 +33,7 @@ describe("getDisplayValueForBundle", () => {
3133
3234 const result = getDisplayValueForBundle ( bundle ) ;
3335
34- expect ( result ) . toBe ( `John${ NBSP } • 25${ NBSP } • false` ) ;
36+ expect ( result ) . toBe ( `John${ ASCII . NBSP } • 25${ ASCII . NBSP } • false` ) ;
3537 } ) ;
3638
3739 it ( "should format null scalar values" , ( ) => {
@@ -45,7 +47,7 @@ describe("getDisplayValueForBundle", () => {
4547 const result = getDisplayValueForBundle ( bundle ) ;
4648
4749 expect ( result ) . toBe (
48- `EmptyField: ${ MISSING_DISPLAY_VALUE } ${ NBSP } • ${ MISSING_DISPLAY_VALUE } `
50+ `EmptyField: ${ MISSING_DISPLAY_VALUE } ${ ASCII . NBSP } • ${ MISSING_DISPLAY_VALUE } `
4951 ) ;
5052 } ) ;
5153
@@ -62,7 +64,7 @@ describe("getDisplayValueForBundle", () => {
6264 const expectedDateFormat = "Dec 25 2023, 10:30 AM" ;
6365
6466 expect ( result ) . toBe (
65- `CreatedAt: ${ expectedDateFormat } ${ NBSP } • ${ expectedDateFormat } `
67+ `CreatedAt: ${ expectedDateFormat } ${ ASCII . NBSP } • ${ expectedDateFormat } `
6668 ) ;
6769 } ) ;
6870
@@ -168,7 +170,7 @@ describe("getDisplayValueForBundle", () => {
168170 const result = getDisplayValueForBundle ( bundle ) ;
169171
170172 expect ( result ) . toBe (
171- `Name: John${ NBSP } • Profile: v(v123)${ NBSP } • Connection: e(e456)${ NBSP } • SubBundle: [...]`
173+ `Name: John${ ASCII . NBSP } • Profile: v(v123)${ ASCII . NBSP } • Connection: e(e456)${ ASCII . NBSP } • SubBundle: [...]`
172174 ) ;
173175 } ) ;
174176
@@ -195,7 +197,7 @@ describe("getDisplayValueForBundle", () => {
195197 const expectedPopulation = new Intl . NumberFormat ( ) . format ( 1000000 ) ;
196198
197199 expect ( result ) . toBe (
198- `Price: ${ expectedPrice } ${ NBSP } • Population: ${ expectedPopulation } `
200+ `Price: ${ expectedPrice } ${ ASCII . NBSP } • Population: ${ expectedPopulation } `
199201 ) ;
200202 } ) ;
201203
@@ -211,7 +213,7 @@ describe("getDisplayValueForBundle", () => {
211213 const upperCaseTransformer = ( text : string ) => text . toUpperCase ( ) ;
212214 const result = getDisplayValueForBundle ( bundle , upperCaseTransformer ) ;
213215
214- expect ( result ) . toBe ( `USER_NAME: JOHN DOE${ NBSP } • STATUS: ACTIVE` ) ;
216+ expect ( result ) . toBe ( `USER_NAME: JOHN DOE${ ASCII . NBSP } • STATUS: ACTIVE` ) ;
215217 } ) ;
216218
217219 it ( "should apply text transformer to scalar values without names" , ( ) => {
@@ -225,7 +227,7 @@ describe("getDisplayValueForBundle", () => {
225227 const upperCaseTransformer = ( text : string ) => text . toUpperCase ( ) ;
226228 const result = getDisplayValueForBundle ( bundle , upperCaseTransformer ) ;
227229
228- expect ( result ) . toBe ( `HELLO WORLD${ NBSP } • TEST VALUE` ) ;
230+ expect ( result ) . toBe ( `HELLO WORLD${ ASCII . NBSP } • TEST VALUE` ) ;
229231 } ) ;
230232
231233 it ( "should apply text transformer to bundle names" , ( ) => {
@@ -258,7 +260,7 @@ describe("getDisplayValueForBundle", () => {
258260 const result = getDisplayValueForBundle ( bundle , upperCaseTransformer ) ;
259261
260262 expect ( result ) . toBe (
261- `user_profile: v(v123)${ NBSP } • connection_edge: e(e456)`
263+ `user_profile: v(v123)${ ASCII . NBSP } • connection_edge: e(e456)`
262264 ) ;
263265 } ) ;
264266
@@ -274,7 +276,7 @@ describe("getDisplayValueForBundle", () => {
274276 const result = getDisplayValueForBundle ( bundle , upperCaseTransformer ) ;
275277
276278 expect ( result ) . toBe (
277- `EMPTY_FIELD: ${ MISSING_DISPLAY_VALUE } ${ NBSP } • ${ MISSING_DISPLAY_VALUE } `
279+ `EMPTY_FIELD: ${ MISSING_DISPLAY_VALUE } ${ ASCII . NBSP } • ${ MISSING_DISPLAY_VALUE } `
278280 ) ;
279281 } ) ;
280282
@@ -295,7 +297,7 @@ describe("getDisplayValueForBundle", () => {
295297 const result = getDisplayValueForBundle ( bundle , upperCaseTransformer ) ;
296298
297299 expect ( result ) . toBe (
298- `NAME: JOHN${ NBSP } • profile: v(v123)${ NBSP } • SUB_BUNDLE: [...]`
300+ `NAME: JOHN${ ASCII . NBSP } • profile: v(v123)${ ASCII . NBSP } • SUB_BUNDLE: [...]`
299301 ) ;
300302 } ) ;
301303
@@ -310,7 +312,7 @@ describe("getDisplayValueForBundle", () => {
310312 const identityTransformer = ( text : string ) => text ;
311313 const result = getDisplayValueForBundle ( bundle , identityTransformer ) ;
312314
313- expect ( result ) . toBe ( `Name: John${ NBSP } • Age: 25` ) ;
315+ expect ( result ) . toBe ( `Name: John${ ASCII . NBSP } • Age: 25` ) ;
314316 } ) ;
315317
316318 it ( "should handle complex transformations" , ( ) => {
@@ -325,7 +327,7 @@ describe("getDisplayValueForBundle", () => {
325327 text . replace ( / _ / g, "-" ) . toLowerCase ( ) ;
326328 const result = getDisplayValueForBundle ( bundle , kebabCaseTransformer ) ;
327329
328- expect ( result ) . toBe ( `field-name: user-name${ NBSP } • some value` ) ;
330+ expect ( result ) . toBe ( `field-name: user-name${ ASCII . NBSP } • some value` ) ;
329331 } ) ;
330332 } ) ;
331333} ) ;
0 commit comments