@@ -14,6 +14,10 @@ const thingClassName = 'DataJourneyTestThing';
1414const refSourceClassName = 'DataJourneyTestRefSource' ;
1515const classCustomVectorClassName = 'ClassCustomVector' ;
1616
17+ const fail = ( msg : string ) => {
18+ throw new Error ( msg ) ;
19+ } ;
20+
1721describe ( 'data' , ( ) => {
1822 const client = weaviate . client ( {
1923 scheme : 'http' ,
@@ -699,6 +703,23 @@ describe('data', () => {
699703 } ) ;
700704 } ) ;
701705
706+ it ( 'forms a exists query with consistency_level set' , ( ) => {
707+ const id = '00000000-0000-0000-0000-000000000000' ;
708+
709+ return client . data
710+ . checker ( )
711+ . withClassName ( thingClassName )
712+ . withId ( id )
713+ . withConsistencyLevel ( 'QUORUM' )
714+ . buildPath ( )
715+ . then ( ( path : string ) => {
716+ expect ( path ) . toContain ( 'consistency_level=QUORUM' ) ;
717+ } )
718+ . catch ( ( e : WeaviateError ) => {
719+ throw new Error ( 'it should not have errord: ' + e ) ;
720+ } ) ;
721+ } ) ;
722+
702723 it ( 'creates object with consistency_level set' , async ( ) => {
703724 const id = '144d1944-3ab4-4aa1-8095-92429d6cbaba' ;
704725 const properties = { foo : 'bar' } ;
@@ -1078,6 +1099,33 @@ describe('data', () => {
10781099 . catch ( ( e ) => fail ( 'it should not have errord: ' + e ) ) ;
10791100 } ) ;
10801101
1102+ it ( 'checks an object exists with consistency_level set' , async ( ) => {
1103+ const id = 'e7c7f6d5-4c9d-4a4e-8e1b-9d3d5a0e4d9f' ;
1104+ const props = { stringProp : 'foobar' } ;
1105+
1106+ await client . data
1107+ . creator ( )
1108+ . withClassName ( thingClassName )
1109+ . withProperties ( props )
1110+ . withId ( id )
1111+ . do ( )
1112+ . then ( ( res ) => {
1113+ expect ( res . properties ) . toEqual ( props ) ;
1114+ expect ( res . id ) . toEqual ( id ) ;
1115+ } )
1116+ . catch ( ( e ) => fail ( 'it should not have errord: ' + e ) ) ;
1117+
1118+ return client . data
1119+ . checker ( )
1120+ . withId ( id )
1121+ . withConsistencyLevel ( 'QUORUM' )
1122+ . do ( )
1123+ . then ( ( exists ) => {
1124+ expect ( exists ) . toBe ( true ) ;
1125+ } )
1126+ . catch ( ( e ) => fail ( 'it should not have errord: ' + e ) ) ;
1127+ } ) ;
1128+
10811129 it ( 'tears down and cleans up' , ( ) => {
10821130 return Promise . all ( [
10831131 client . schema . classDeleter ( ) . withClassName ( thingClassName ) . do ( ) ,
0 commit comments