11import { afterAll , beforeEach , describe , expect , test } from "vitest" ;
2- < < < << << HEAD
3- import {
4- config ,
5- getClient ,
6- clearAllIndexes ,
7- } from "./utils/meilisearch-test-utils" ;
8- import { sleep } from "../src/utils" ;
9- === === =
102import { config , getClient , clearAllIndexes } from "./utils/meilisearch-test-utils" ;
11- >>> >>> > 87 ac02b ( Add getBatch )
123
134const index = {
145 uid : "batch-test" ,
@@ -18,49 +9,6 @@ afterAll(() => {
189 return clearAllIndexes ( config ) ;
1910} ) ;
2011
21- < < < << << HEAD
22- describe . each ( [ { permission : "Master" } , { permission : "Admin" } ] ) (
23- "Tests on batches" ,
24- ( { permission } ) => {
25- beforeEach ( async ( ) => {
26- const client = await getClient ( "Master" ) ;
27- const { taskUid } = await client . createIndex (
28- `${ permission } -${ index . uid } ` ,
29- ) ;
30- await client . waitForTask ( taskUid ) ;
31- } ) ;
32-
33- test ( `${ permission } key: Get all batches` , async ( ) => {
34- const client = await getClient ( permission ) ;
35- const { taskUid } = await client . createIndex (
36- `${ permission } -${ index . uid } -second-index` ,
37- ) ;
38- await client . waitForTask ( taskUid ) ;
39- const batches = await client . getBatches ( { limit : 2 } ) ;
40-
41- expect ( batches . results ) . toBeInstanceOf ( Array ) ;
42- expect ( batches . results . length ) . toEqual ( 2 ) ;
43- expect ( batches . total ) . toBeGreaterThan ( 0 ) ;
44- expect ( batches . results [ 0 ] ) . toHaveProperty ( "uid" ) ;
45- expect ( batches . results [ 0 ] ) . toHaveProperty ( "details" ) ;
46- expect ( batches . results [ 0 ] ) . toHaveProperty ( "stats" ) ;
47- expect ( batches . results [ 0 ] ) . toHaveProperty ( "duration" ) ;
48- expect ( batches . results [ 0 ] ) . toHaveProperty ( "startedAt" ) ;
49- expect ( batches . results [ 0 ] ) . toHaveProperty ( "finishedAt" ) ;
50- } ) ;
51-
52- test ( `${ permission } key: Get one batch` , async ( ) => {
53- const client = await getClient ( permission ) ;
54-
55- const batches = await client . getBatches ( {
56- limit : 1 ,
57- } ) ;
58- console . log ( "batches" , batches . results [ 0 ] . uid , "exists" ) ;
59-
60- const batch = await client . getBatch ( batches . results [ 0 ] . uid ) ;
61- expect ( batch . uid ) . toEqual ( batches . results [ 0 ] . uid ) ;
62- expect ( batch . details ) . toBeInstanceOf ( Object ) ;
63- = === ===
6412describe . each ( [
6513 { permission : "Master" } ,
6614 { permission : "Admin" }
@@ -78,7 +26,6 @@ describe.each([
7826 expect ( batch . uid ) . toEqual ( 1 ) ;
7927 expect ( batch . details ) . toHaveProperty ( "receivedDocuments" ) ;
8028 expect ( batch . details ) . toHaveProperty ( "indexedDocuments" ) ;
81- > >>> >>> 87 ac02b ( Add getBatch )
8229 expect ( batch . stats ) . toHaveProperty ( "totalNbTasks" ) ;
8330 expect ( batch . stats ) . toHaveProperty ( "status" ) ;
8431 expect ( batch . stats ) . toHaveProperty ( "types" ) ;
@@ -89,7 +36,3 @@ describe.each([
8936 } ) ;
9037 } ,
9138) ;
92- < < < << << HEAD
93- = === ===
94-
95- >>> >>> > 87 ac02b ( Add getBatch )
0 commit comments