@@ -1227,7 +1227,7 @@ describe('query with generative search', () => {
12271227 . withClassName ( 'Wine' )
12281228 . withFields ( 'name review' )
12291229 . withGenerate ( {
1230- singlePrompt : `Describe the following as a Facebook Ad:
1230+ singlePrompt : `Describe the following as a Facebook Ad:
12311231Tastes like a fresh ocean breeze: {review}` ,
12321232 } )
12331233 . do ( )
@@ -1274,6 +1274,76 @@ Tastes like a fresh ocean breeze: {review}`,
12741274 } ) ;
12751275} ) ;
12761276
1277+ describe ( 'query cluster with consistency level' , ( ) => {
1278+ const client = weaviate . client ( {
1279+ scheme : 'http' ,
1280+ host : 'localhost:8087' ,
1281+ } ) ;
1282+
1283+ it ( 'sets up replicated class' , ( ) => {
1284+ return setupReplicated ( client ) ;
1285+ } ) ;
1286+
1287+ test ( 'One' , ( ) => {
1288+ return client . graphql
1289+ . get ( )
1290+ . withClassName ( 'Article' )
1291+ . withFields ( '_additional { id isConsistent }' )
1292+ . withConsistencyLevel ( 'ONE' )
1293+ . do ( )
1294+ . then ( ( res : any ) => {
1295+ expect ( res . data . Get . Article . length ) . toBeGreaterThan ( 0 ) ;
1296+ res . data . Get . Article . forEach ( ( article : any ) => {
1297+ expect ( article . _additional . isConsistent ) . toBeTruthy ( ) ;
1298+ } ) ;
1299+ return res ;
1300+ } )
1301+ . catch ( ( e : any ) => {
1302+ throw new Error ( `unexpected error: ${ JSON . stringify ( e ) } ` ) ;
1303+ } ) ;
1304+ } ) ;
1305+
1306+ test ( 'Quorum' , ( ) => {
1307+ return client . graphql
1308+ . get ( )
1309+ . withClassName ( 'Article' )
1310+ . withFields ( '_additional { id isConsistent }' )
1311+ . withConsistencyLevel ( 'QUORUM' )
1312+ . do ( )
1313+ . then ( ( res : any ) => {
1314+ expect ( res . data . Get . Article . length ) . toBeGreaterThan ( 0 ) ;
1315+ res . data . Get . Article . forEach ( ( article : any ) => {
1316+ expect ( article . _additional . isConsistent ) . toBeTruthy ( ) ;
1317+ } ) ;
1318+ } )
1319+ . catch ( ( e : any ) => {
1320+ throw new Error ( `unexpected error: ${ JSON . stringify ( e ) } ` ) ;
1321+ } ) ;
1322+ } ) ;
1323+
1324+ test ( 'All' , ( ) => {
1325+ return client . graphql
1326+ . get ( )
1327+ . withClassName ( 'Article' )
1328+ . withFields ( '_additional { id isConsistent }' )
1329+ . withConsistencyLevel ( 'ALL' )
1330+ . do ( )
1331+ . then ( ( res : any ) => {
1332+ expect ( res . data . Get . Article . length ) . toBeGreaterThan ( 0 ) ;
1333+ res . data . Get . Article . forEach ( ( article : any ) => {
1334+ expect ( article . _additional . isConsistent ) . toBeTruthy ( ) ;
1335+ } ) ;
1336+ } )
1337+ . catch ( ( e : any ) => {
1338+ throw new Error ( `unexpected error: ${ JSON . stringify ( e ) } ` ) ;
1339+ } ) ;
1340+ } ) ;
1341+
1342+ it ( 'tears down cluster schema' , ( ) => {
1343+ return Promise . all ( [ client . schema . classDeleter ( ) . withClassName ( 'Article' ) . do ( ) ] ) ;
1344+ } ) ;
1345+ } ) ;
1346+
12771347const setup = async ( client : WeaviateClient ) => {
12781348 const thing = {
12791349 class : 'Article' ,
0 commit comments