@@ -59,9 +59,9 @@ describe('CRUD — Notes', () => {
5959 let id3 : string ;
6060
6161 describe ( 'createNote' , ( ) => {
62- it ( 'returns slug id' , ( ) => {
62+ it ( 'returns uuid id' , ( ) => {
6363 id1 = createNote ( g , 'Auth uses JWT' , 'The system authenticates via JWT tokens.' , [ 'auth' , 'security' ] , unitVec ( 0 ) ) ;
64- expect ( id1 ) . toBe ( 'auth-uses-jwt' ) ;
64+ expect ( id1 ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - / ) ;
6565 } ) ;
6666
6767 it ( 'node exists' , ( ) => {
@@ -94,12 +94,12 @@ describe('CRUD — Notes', () => {
9494
9595 it ( 'second note created' , ( ) => {
9696 id2 = createNote ( g , 'Database is Postgres' , 'We use PostgreSQL 15.' , [ 'infra' ] , unitVec ( 1 ) ) ;
97- expect ( id2 ) . toBe ( 'database-is-postgres' ) ;
97+ expect ( id2 ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - / ) ;
9898 } ) ;
9999
100100 it ( 'third note created' , ( ) => {
101101 id3 = createNote ( g , 'Rate limiting' , 'API has 100 req/min limit.' , [ 'api' ] , unitVec ( 2 ) ) ;
102- expect ( id3 ) . toBe ( 'rate-limiting' ) ;
102+ expect ( id3 ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - / ) ;
103103 } ) ;
104104 } ) ;
105105
@@ -329,7 +329,7 @@ describe('searchKnowledge', () => {
329329
330330 it ( 'exact match: auth note' , ( ) => {
331331 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 0 , minScore : 0.5 } ) ;
332- expect ( hits [ 0 ] . id ) . toBe ( 'auth-jwt' ) ;
332+ expect ( hits [ 0 ] . id ) . toBe ( sn1 ) ;
333333 } ) ;
334334
335335 it ( 'exact match: score 1.0' , ( ) => {
@@ -354,53 +354,53 @@ describe('searchKnowledge', () => {
354354
355355 it ( 'BFS depth=1 includes seed' , ( ) => {
356356 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 } ) ;
357- expect ( hits . map ( h => h . id ) ) . toContain ( 'auth-jwt' ) ;
357+ expect ( hits . map ( h => h . id ) ) . toContain ( sn1 ) ;
358358 } ) ;
359359
360360 it ( 'BFS depth=1 includes database via depends_on' , ( ) => {
361361 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 } ) ;
362- expect ( hits . map ( h => h . id ) ) . toContain ( 'database' ) ;
362+ expect ( hits . map ( h => h . id ) ) . toContain ( sn2 ) ;
363363 } ) ;
364364
365365 it ( 'BFS depth=1 does NOT include rate-limit (depth 2)' , ( ) => {
366366 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 } ) ;
367- expect ( hits . map ( h => h . id ) ) . not . toContain ( 'api-rate-limit' ) ;
367+ expect ( hits . map ( h => h . id ) ) . not . toContain ( sn3 ) ;
368368 } ) ;
369369
370370 it ( 'BFS depth=2 includes rate-limit' , ( ) => {
371371 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 2 , minScore : 0 } ) ;
372- expect ( hits . map ( h => h . id ) ) . toContain ( 'api-rate-limit' ) ;
372+ expect ( hits . map ( h => h . id ) ) . toContain ( sn3 ) ;
373373 } ) ;
374374
375375 it ( 'BFS score < seed score' , ( ) => {
376376 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 } ) ;
377- const seedScore = hits . find ( h => h . id === 'auth-jwt' ) ! . score ;
378- const bfsScore = hits . find ( h => h . id === 'database' ) ! . score ;
377+ const seedScore = hits . find ( h => h . id === sn1 ) ! . score ;
378+ const bfsScore = hits . find ( h => h . id === sn2 ) ! . score ;
379379 expect ( bfsScore ) . toBeLessThan ( seedScore ) ;
380380 } ) ;
381381
382382 it ( 'BFS score = seed * 0.8' , ( ) => {
383383 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 } ) ;
384- const seedScore = hits . find ( h => h . id === 'auth-jwt' ) ! . score ;
385- const bfsScore = hits . find ( h => h . id === 'database' ) ! . score ;
384+ const seedScore = hits . find ( h => h . id === sn1 ) ! . score ;
385+ const bfsScore = hits . find ( h => h . id === sn2 ) ! . score ;
386386 expect ( Math . abs ( bfsScore - seedScore * 0.8 ) ) . toBeLessThan ( 0.001 ) ;
387387 } ) ;
388388
389389 it ( 'minScore=0.9 returns only seed' , ( ) => {
390390 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 , minScore : 0.9 } ) ;
391391 expect ( hits ) . toHaveLength ( 1 ) ;
392- expect ( hits [ 0 ] . id ) . toBe ( 'auth-jwt' ) ;
392+ expect ( hits [ 0 ] . id ) . toBe ( sn1 ) ;
393393 } ) ;
394394
395395 it ( 'bfsDecay=1.0 keeps full score' , ( ) => {
396396 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 , bfsDecay : 1.0 , minScore : 0.99 } ) ;
397- expect ( hits . some ( h => h . id === 'database' ) ) . toBe ( true ) ;
397+ expect ( hits . some ( h => h . id === sn2 ) ) . toBe ( true ) ;
398398 } ) ;
399399
400400 it ( 'bfsDecay=0.0 filters BFS nodes' , ( ) => {
401401 const hits = searchKnowledge ( sg , unitVec ( 0 ) , { topK : 1 , bfsDepth : 1 , bfsDecay : 0.0 , minScore : 0.01 } ) ;
402402 expect ( hits ) . toHaveLength ( 1 ) ;
403- expect ( hits [ 0 ] . id ) . toBe ( 'auth-jwt' ) ;
403+ expect ( hits [ 0 ] . id ) . toBe ( sn1 ) ;
404404 } ) ;
405405
406406 it ( 'maxResults=1 caps output' , ( ) => {
@@ -854,7 +854,7 @@ describe('persistence round-trip (knowledge)', () => {
854854
855855 // Verify a new note can be created via Manager on the loaded graph
856856 const n4 = await manager . createNote ( 'New Note' , 'Created after load' , [ 'test' ] ) ;
857- expect ( n4 ) . toBe ( 'new-note' ) ;
857+ expect ( n4 ) . toMatch ( / ^ [ 0 - 9 a - f ] { 8 } - / ) ;
858858 expect ( listNotes ( loaded ) ) . toHaveLength ( 4 ) ;
859859 expect ( manager . bm25Index . size ) . toBe ( 4 ) ;
860860 } ) ;
0 commit comments