1
1
import { QueryEngine } from '@comunica/query-sparql'
2
2
import { DataFactory } from 'n3'
3
3
import { expect , test } from 'vitest'
4
- import { TextStore , tsst } from './TextStore'
4
+ import { TextStore , defaultSearchTerm } from './TextStore'
5
5
const { namedNode, literal, quad } = DataFactory
6
6
7
7
const createStore = ( ) => {
@@ -16,22 +16,22 @@ const createStore = () => {
16
16
17
17
test ( 'match, check additions and deletions' , ( ) => {
18
18
const store = createStore ( )
19
- const result = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Jo' ) ) ]
19
+ const result = [ ...store . match ( null , defaultSearchTerm , literal ( 'Jo' ) ) ]
20
20
expect ( result [ 0 ] . object . value ) . toBe ( 'John Doe' )
21
21
expect ( result [ 1 ] . object . value ) . toBe ( 'Johanna Doe' )
22
22
expect ( result . length ) . toBe ( 2 )
23
23
24
- const result2 = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Peter' ) ) ]
24
+ const result2 = [ ...store . match ( null , defaultSearchTerm , literal ( 'Peter' ) ) ]
25
25
expect ( result2 . length ) . toBe ( 0 )
26
26
store . add ( quad ( namedNode ( 'c' ) , namedNode ( 'https://schema.org/name' ) , literal ( 'Peter Peterson' ) ) )
27
27
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' ) ) ]
29
29
expect ( result3 . length ) . toBe ( 2 )
30
30
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' ) ) ]
32
32
expect ( result4 . length ) . toBe ( 1 )
33
33
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' ) ) ]
35
35
expect ( result5 . length ) . toBe ( 0 )
36
36
} )
37
37
@@ -59,7 +59,7 @@ test('initialization with quads', () => {
59
59
const store = new TextStore ( {
60
60
storeOptions : [ quad ( namedNode ( 'a' ) , namedNode ( 'https://schema.org/name' ) , literal ( 'John Doe' ) ) ]
61
61
} )
62
- const result = [ ...store . match ( null , tsst ( 'search' ) , literal ( 'Jo' ) ) ]
62
+ const result = [ ...store . match ( null , defaultSearchTerm , literal ( 'Jo' ) ) ]
63
63
expect ( result [ 0 ] . object . value ) . toBe ( 'John Doe' )
64
64
expect ( result . length ) . toBe ( 1 )
65
65
} )
0 commit comments