11import { QueryEngine } from '@comunica/query-sparql'
22import { DataFactory } from 'n3'
33import { expect , test } from 'vitest'
4- import { TextStore , tsst } from './TextStore'
4+ import { TextStore , defaultSearchTerm } from './TextStore'
55const { namedNode, literal, quad } = DataFactory
66
77const createStore = ( ) => {
@@ -16,22 +16,22 @@ const createStore = () => {
1616
1717test ( 'match, check additions and deletions' , ( ) => {
1818 const store = createStore ( )
19- const result = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Jo' ) ) ]
19+ const result = [ ...store . match ( null , defaultSearchTerm , literal ( 'Jo' ) ) ]
2020 expect ( result [ 0 ] . object . value ) . toBe ( 'John Doe' )
2121 expect ( result [ 1 ] . object . value ) . toBe ( 'Johanna Doe' )
2222 expect ( result . length ) . toBe ( 2 )
2323
24- const result2 = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Peter' ) ) ]
24+ const result2 = [ ...store . match ( null , defaultSearchTerm , literal ( 'Peter' ) ) ]
2525 expect ( result2 . length ) . toBe ( 0 )
2626 store . add ( quad ( namedNode ( 'c' ) , namedNode ( 'https://schema.org/name' ) , literal ( 'Peter Peterson' ) ) )
2727 store . add ( quad ( namedNode ( 'c' ) , namedNode ( 'https://schema.org/name' ) , literal ( 'Peter Jackson' ) ) )
28- const result3 = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Peter' ) ) ]
28+ const result3 = [ ...store . match ( null , defaultSearchTerm , literal ( 'Peter' ) ) ]
2929 expect ( result3 . length ) . toBe ( 2 )
3030 store . delete ( quad ( namedNode ( 'c' ) , namedNode ( 'https://schema.org/name' ) , literal ( 'Peter Peterson' ) ) )
31- const result4 = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Peter' ) ) ]
31+ const result4 = [ ...store . match ( null , defaultSearchTerm , literal ( 'Peter' ) ) ]
3232 expect ( result4 . length ) . toBe ( 1 )
3333 store . delete ( quad ( namedNode ( 'c' ) , namedNode ( 'https://schema.org/name' ) , literal ( 'Peter Jackson' ) ) )
34- const result5 = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Peter' ) ) ]
34+ const result5 = [ ...store . match ( null , defaultSearchTerm , literal ( 'Peter' ) ) ]
3535 expect ( result5 . length ) . toBe ( 0 )
3636} )
3737
@@ -59,7 +59,7 @@ test('initialization with quads', () => {
5959 const store = new TextStore ( {
6060 storeOptions : [ quad ( namedNode ( 'a' ) , namedNode ( 'https://schema.org/name' ) , literal ( 'John Doe' ) ) ]
6161 } )
62- const result = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Jo' ) ) ]
62+ const result = [ ...store . match ( null , defaultSearchTerm , literal ( 'Jo' ) ) ]
6363 expect ( result [ 0 ] . object . value ) . toBe ( 'John Doe' )
6464 expect ( result . length ) . toBe ( 1 )
6565} )
0 commit comments