@@ -32,11 +32,13 @@ export const mockEndpointResultList: (options?: {
3232 total ?: number ;
3333 request_page_size ?: number ;
3434 request_page_index ?: number ;
35+ query_strategy_version ?: MetadataQueryStrategyVersions ;
3536} ) => HostResultList = ( options = { } ) => {
3637 const {
3738 total = 1 ,
3839 request_page_size : requestPageSize = 10 ,
3940 request_page_index : requestPageIndex = 0 ,
41+ query_strategy_version : queryStrategyVersion = MetadataQueryStrategyVersions . VERSION_2 ,
4042 } = options ;
4143
4244 // Skip any that are before the page we're on
@@ -50,15 +52,15 @@ export const mockEndpointResultList: (options?: {
5052 hosts . push ( {
5153 metadata : generator . generateHostMetadata ( ) ,
5254 host_status : HostStatus . ERROR ,
53- query_strategy_version : MetadataQueryStrategyVersions . VERSION_2 ,
55+ query_strategy_version : queryStrategyVersion ,
5456 } ) ;
5557 }
5658 const mock : HostResultList = {
5759 hosts,
5860 total,
5961 request_page_size : requestPageSize ,
6062 request_page_index : requestPageIndex ,
61- query_strategy_version : MetadataQueryStrategyVersions . VERSION_2 ,
63+ query_strategy_version : queryStrategyVersion ,
6264 } ;
6365 return mock ;
6466} ;
@@ -84,13 +86,15 @@ const endpointListApiPathHandlerMocks = ({
8486 endpointPackagePolicies = [ ] ,
8587 policyResponse = generator . generatePolicyResponse ( ) ,
8688 agentPolicy = generator . generateAgentPolicy ( ) ,
89+ queryStrategyVersion = MetadataQueryStrategyVersions . VERSION_2 ,
8790} : {
8891 /** route handlers will be setup for each individual host in this array */
8992 endpointsResults ?: HostResultList [ 'hosts' ] ;
9093 epmPackages ?: GetPackagesResponse [ 'response' ] ;
9194 endpointPackagePolicies ?: GetPolicyListResponse [ 'items' ] ;
9295 policyResponse ?: HostPolicyResponse ;
9396 agentPolicy ?: GetAgentPoliciesResponseItem ;
97+ queryStrategyVersion ?: MetadataQueryStrategyVersions ;
9498} = { } ) => {
9599 const apiHandlers = {
96100 // endpoint package info
@@ -107,7 +111,7 @@ const endpointListApiPathHandlerMocks = ({
107111 request_page_size : 10 ,
108112 request_page_index : 0 ,
109113 total : endpointsResults ?. length || 0 ,
110- query_strategy_version : MetadataQueryStrategyVersions . VERSION_2 ,
114+ query_strategy_version : queryStrategyVersion ,
111115 } ;
112116 } ,
113117
@@ -164,11 +168,16 @@ export const setEndpointListApiMockImplementation: (
164168 apiResponses ?: Parameters < typeof endpointListApiPathHandlerMocks > [ 0 ]
165169) => void = (
166170 mockedHttpService ,
167- { endpointsResults = mockEndpointResultList ( { total : 3 } ) . hosts , ...pathHandlersOptions } = { }
171+ {
172+ endpointsResults = mockEndpointResultList ( { total : 3 } ) . hosts ,
173+ queryStrategyVersion = MetadataQueryStrategyVersions . VERSION_2 ,
174+ ...pathHandlersOptions
175+ } = { }
168176) => {
169177 const apiHandlers = endpointListApiPathHandlerMocks ( {
170178 ...pathHandlersOptions ,
171179 endpointsResults,
180+ queryStrategyVersion,
172181 } ) ;
173182
174183 mockedHttpService . post
0 commit comments