@@ -25,23 +25,6 @@ const noUnenrolledEndpoint = () =>
2525
2626describe ( 'test find all unenrolled HostId' , ( ) => {
2727 let mockScopedClient : jest . Mocked < IScopedClusterClient > ;
28- const expectedAllUnenrolledHostQuery = {
29- index : metadataMirrorIndexPattern ,
30- scroll : '10s' ,
31- body : {
32- size : 1000 ,
33- _source : [ 'host.id' ] ,
34- query : {
35- bool : {
36- filter : {
37- term : {
38- 'Endpoint.status' : EndpointStatus . unenrolled ,
39- } ,
40- } ,
41- } ,
42- } ,
43- } ,
44- } ;
4528
4629 it ( 'can find all hits with scroll' , async ( ) => {
4730 const firstHostId = '1fdca33f-799f-49f4-939c-ea4383c77671' ;
@@ -74,9 +57,23 @@ describe('test find all unenrolled HostId', () => {
7457 . mockImplementationOnce ( noUnenrolledEndpoint ) ;
7558 const hostIds = await findAllUnenrolledHostIds ( mockScopedClient ) ;
7659
77- expect ( mockScopedClient . callAsCurrentUser . mock . calls [ 0 ] [ 1 ] ) . toEqual (
78- expectedAllUnenrolledHostQuery
79- ) ;
60+ expect ( mockScopedClient . callAsCurrentUser . mock . calls [ 0 ] [ 1 ] ) . toEqual ( {
61+ index : metadataMirrorIndexPattern ,
62+ scroll : '30s' ,
63+ body : {
64+ size : 1000 ,
65+ _source : [ 'host.id' ] ,
66+ query : {
67+ bool : {
68+ filter : {
69+ term : {
70+ 'Endpoint.status' : EndpointStatus . unenrolled ,
71+ } ,
72+ } ,
73+ } ,
74+ } ,
75+ } ,
76+ } ) ;
8077 expect ( hostIds ) . toEqual ( [
8178 { host : { id : firstEndpointHostId } } ,
8279 { host : { id : secondEndpointHostId } } ,
@@ -94,6 +91,9 @@ describe('test find unenrolled endpoint host id by hostId', () => {
9491 Promise . resolve ( createSearchResponse ( firstEndpointHostId , 'initialScrollId' ) )
9592 ) ;
9693 const endpointHostId = await findUnenrolledHostByHostId ( mockScopedClient , firstEndpointHostId ) ;
94+ expect ( mockScopedClient . callAsCurrentUser . mock . calls [ 0 ] [ 1 ] ?. index ) . toEqual (
95+ metadataMirrorIndexPattern
96+ ) ;
9797 expect ( mockScopedClient . callAsCurrentUser . mock . calls [ 0 ] [ 1 ] ?. body ) . toEqual ( {
9898 size : 1 ,
9999 _source : [ 'host.id' ] ,
0 commit comments