@@ -10,6 +10,7 @@ const raowtState: Record<
10
10
string ,
11
11
{
12
12
copyCount : number ;
13
+ deleteCount : number ;
13
14
pushCount : number ;
14
15
tmpIndexName : string ;
15
16
waitTaskCount : number ;
@@ -33,6 +34,27 @@ function addRoutes(app: Express): void {
33
34
} ) ,
34
35
) ;
35
36
37
+ app . delete ( '/1/indexes/:indexName' , ( req , res ) => {
38
+ expect ( req . params . indexName ) . to . match ( / ^ c t s _ e 2 e _ r e p l a c e _ a l l _ o b j e c t s _ w i t h _ t r a n s f o r m a t i o n _ ( .* ) $ / ) ;
39
+
40
+ const lang = req . params . indexName . replace ( 'cts_e2e_replace_all_objects_with_transformation_' , '' ) ;
41
+ if ( ! raowtState [ lang ] || raowtState [ lang ] . successful ) {
42
+ raowtState [ lang ] = {
43
+ copyCount : 0 ,
44
+ pushCount : 0 ,
45
+ deleteCount : 1 ,
46
+ waitTaskCount : 0 ,
47
+ tmpIndexName : req . body . destination ,
48
+ waitingForFinalWaitTask : false ,
49
+ successful : false ,
50
+ } ;
51
+ } else {
52
+ raowtState [ lang ] . deleteCount ++ ;
53
+ }
54
+
55
+ res . json ( { taskID : 123 + raowtState [ lang ] . copyCount , deletedAt : '2021-01-01T00:00:00.000Z' } ) ;
56
+ } ) ;
57
+
36
58
app . post ( '/1/indexes/:indexName/operation' , ( req , res ) => {
37
59
expect ( req . params . indexName ) . to . match ( / ^ c t s _ e 2 e _ r e p l a c e _ a l l _ o b j e c t s _ w i t h _ t r a n s f o r m a t i o n _ ( .* ) $ / ) ;
38
60
@@ -47,6 +69,7 @@ function addRoutes(app: Express): void {
47
69
raowtState [ lang ] = {
48
70
copyCount : 1 ,
49
71
pushCount : 0 ,
72
+ deleteCount : 0 ,
50
73
waitTaskCount : 0 ,
51
74
tmpIndexName : req . body . destination ,
52
75
waitingForFinalWaitTask : false ,
@@ -123,10 +146,17 @@ function addRoutes(app: Express): void {
123
146
124
147
raowtState [ lang ] . waitTaskCount ++ ;
125
148
if ( raowtState [ lang ] . waitingForFinalWaitTask ) {
126
- expect ( req . params . taskID ) . to . equal ( '777' ) ;
127
- expect ( raowtState [ lang ] . waitTaskCount ) . to . equal ( 3 ) ;
128
-
129
149
raowtState [ lang ] . successful = true ;
150
+ expect ( req . params . taskID ) . to . equal ( '777' ) ;
151
+ expect ( raowtState [ lang ] ) . to . deep . equal ( {
152
+ copyCount : 2 ,
153
+ pushCount : 10 ,
154
+ deleteCount : 0 ,
155
+ waitTaskCount : 3 ,
156
+ tmpIndexName : req . params . indexName ,
157
+ waitingForFinalWaitTask : true ,
158
+ successful : true ,
159
+ } ) ;
130
160
}
131
161
132
162
res . json ( { status : 'published' , updatedAt : '2021-01-01T00:00:00.000Z' } ) ;
0 commit comments