66 */
77
88import { get } from 'lodash' ;
9- import { DEFAULT_INDICATOR_PATH } from '../../../../../common/constants' ;
9+ import { INDICATOR_DESTINATION_PATH } from '../../../../../common/constants' ;
1010
1111import { getThreatListItemMock } from './build_threat_mapping_filter.mock' ;
1212import {
@@ -94,7 +94,7 @@ describe('buildMatchedIndicator', () => {
9494 const indicators = buildMatchedIndicator ( {
9595 queries : [ ] ,
9696 threats,
97- indicatorPath : DEFAULT_INDICATOR_PATH ,
97+ indicatorPath : 'threat.indicator' ,
9898 } ) ;
9999
100100 expect ( indicators ) . toEqual ( [ ] ) ;
@@ -104,7 +104,7 @@ describe('buildMatchedIndicator', () => {
104104 const [ indicator ] = buildMatchedIndicator ( {
105105 queries,
106106 threats,
107- indicatorPath : DEFAULT_INDICATOR_PATH ,
107+ indicatorPath : 'threat.indicator' ,
108108 } ) ;
109109
110110 expect ( get ( indicator , 'matched.atomic' ) ) . toEqual ( 'domain_1' ) ;
@@ -114,7 +114,7 @@ describe('buildMatchedIndicator', () => {
114114 const [ indicator ] = buildMatchedIndicator ( {
115115 queries,
116116 threats,
117- indicatorPath : DEFAULT_INDICATOR_PATH ,
117+ indicatorPath : 'threat.indicator' ,
118118 } ) ;
119119
120120 expect ( get ( indicator , 'matched.field' ) ) . toEqual ( 'event.field' ) ;
@@ -124,7 +124,7 @@ describe('buildMatchedIndicator', () => {
124124 const [ indicator ] = buildMatchedIndicator ( {
125125 queries,
126126 threats,
127- indicatorPath : DEFAULT_INDICATOR_PATH ,
127+ indicatorPath : 'threat.indicator' ,
128128 } ) ;
129129
130130 expect ( get ( indicator , 'matched.type' ) ) . toEqual ( 'type_1' ) ;
@@ -153,7 +153,7 @@ describe('buildMatchedIndicator', () => {
153153 const indicators = buildMatchedIndicator ( {
154154 queries,
155155 threats,
156- indicatorPath : DEFAULT_INDICATOR_PATH ,
156+ indicatorPath : 'threat.indicator' ,
157157 } ) ;
158158
159159 expect ( indicators ) . toHaveLength ( queries . length ) ;
@@ -163,7 +163,7 @@ describe('buildMatchedIndicator', () => {
163163 const indicators = buildMatchedIndicator ( {
164164 queries,
165165 threats,
166- indicatorPath : DEFAULT_INDICATOR_PATH ,
166+ indicatorPath : 'threat.indicator' ,
167167 } ) ;
168168
169169 expect ( indicators ) . toEqual ( [
@@ -228,7 +228,7 @@ describe('buildMatchedIndicator', () => {
228228 const indicators = buildMatchedIndicator ( {
229229 queries,
230230 threats,
231- indicatorPath : DEFAULT_INDICATOR_PATH ,
231+ indicatorPath : 'threat.indicator' ,
232232 } ) ;
233233
234234 expect ( indicators ) . toEqual ( [
@@ -253,7 +253,7 @@ describe('buildMatchedIndicator', () => {
253253 const indicators = buildMatchedIndicator ( {
254254 queries,
255255 threats,
256- indicatorPath : DEFAULT_INDICATOR_PATH ,
256+ indicatorPath : 'threat.indicator' ,
257257 } ) ;
258258
259259 expect ( indicators ) . toEqual ( [
@@ -285,7 +285,7 @@ describe('buildMatchedIndicator', () => {
285285 const indicators = buildMatchedIndicator ( {
286286 queries,
287287 threats,
288- indicatorPath : DEFAULT_INDICATOR_PATH ,
288+ indicatorPath : 'threat.indicator' ,
289289 } ) ;
290290
291291 expect ( indicators ) . toEqual ( [
@@ -317,7 +317,7 @@ describe('buildMatchedIndicator', () => {
317317 buildMatchedIndicator ( {
318318 queries,
319319 threats,
320- indicatorPath : DEFAULT_INDICATOR_PATH ,
320+ indicatorPath : 'threat.indicator' ,
321321 } )
322322 ) . toThrowError ( 'Expected indicator field to be an object, but found: not an object' ) ;
323323 } ) ;
@@ -338,7 +338,7 @@ describe('buildMatchedIndicator', () => {
338338 buildMatchedIndicator ( {
339339 queries,
340340 threats,
341- indicatorPath : DEFAULT_INDICATOR_PATH ,
341+ indicatorPath : 'threat.indicator' ,
342342 } )
343343 ) . toThrowError ( 'Expected indicator field to be an object, but found: not an object' ) ;
344344 } ) ;
@@ -367,7 +367,7 @@ describe('enrichSignalThreatMatches', () => {
367367 const enrichedSignals = await enrichSignalThreatMatches (
368368 signals ,
369369 getMatchedThreats ,
370- DEFAULT_INDICATOR_PATH
370+ 'threat.indicator'
371371 ) ;
372372
373373 expect ( enrichedSignals . hits . hits ) . toEqual ( [ ] ) ;
@@ -382,10 +382,10 @@ describe('enrichSignalThreatMatches', () => {
382382 const enrichedSignals = await enrichSignalThreatMatches (
383383 signals ,
384384 getMatchedThreats ,
385- DEFAULT_INDICATOR_PATH
385+ 'threat.indicator'
386386 ) ;
387387 const [ enrichedHit ] = enrichedSignals . hits . hits ;
388- const indicators = get ( enrichedHit . _source , DEFAULT_INDICATOR_PATH ) ;
388+ const indicators = get ( enrichedHit . _source , INDICATOR_DESTINATION_PATH ) ;
389389
390390 expect ( indicators ) . toEqual ( [
391391 { existing : 'indicator' } ,
@@ -407,10 +407,10 @@ describe('enrichSignalThreatMatches', () => {
407407 const enrichedSignals = await enrichSignalThreatMatches (
408408 signals ,
409409 getMatchedThreats ,
410- DEFAULT_INDICATOR_PATH
410+ 'threat.indicator'
411411 ) ;
412412 const [ enrichedHit ] = enrichedSignals . hits . hits ;
413- const indicators = get ( enrichedHit . _source , DEFAULT_INDICATOR_PATH ) ;
413+ const indicators = get ( enrichedHit . _source , INDICATOR_DESTINATION_PATH ) ;
414414
415415 expect ( indicators ) . toEqual ( [
416416 {
@@ -428,10 +428,10 @@ describe('enrichSignalThreatMatches', () => {
428428 const enrichedSignals = await enrichSignalThreatMatches (
429429 signals ,
430430 getMatchedThreats ,
431- DEFAULT_INDICATOR_PATH
431+ 'threat.indicator'
432432 ) ;
433433 const [ enrichedHit ] = enrichedSignals . hits . hits ;
434- const indicators = get ( enrichedHit . _source , DEFAULT_INDICATOR_PATH ) ;
434+ const indicators = get ( enrichedHit . _source , INDICATOR_DESTINATION_PATH ) ;
435435
436436 expect ( indicators ) . toEqual ( [
437437 { existing : 'indicator' } ,
@@ -451,7 +451,7 @@ describe('enrichSignalThreatMatches', () => {
451451 } ) ;
452452 const signals = getSignalsResponseMock ( [ signalHit ] ) ;
453453 await expect ( ( ) =>
454- enrichSignalThreatMatches ( signals , getMatchedThreats , DEFAULT_INDICATOR_PATH )
454+ enrichSignalThreatMatches ( signals , getMatchedThreats , 'threat.indicator' )
455455 ) . rejects . toThrowError ( 'Expected threat field to be an object, but found: whoops' ) ;
456456 } ) ;
457457
@@ -487,7 +487,7 @@ describe('enrichSignalThreatMatches', () => {
487487 'custom_threat.custom_indicator'
488488 ) ;
489489 const [ enrichedHit ] = enrichedSignals . hits . hits ;
490- const indicators = get ( enrichedHit . _source , DEFAULT_INDICATOR_PATH ) ;
490+ const indicators = get ( enrichedHit . _source , INDICATOR_DESTINATION_PATH ) ;
491491
492492 expect ( indicators ) . toEqual ( [
493493 {
@@ -530,13 +530,13 @@ describe('enrichSignalThreatMatches', () => {
530530 const enrichedSignals = await enrichSignalThreatMatches (
531531 signals ,
532532 getMatchedThreats ,
533- DEFAULT_INDICATOR_PATH
533+ 'threat.indicator'
534534 ) ;
535535 expect ( enrichedSignals . hits . total ) . toEqual ( expect . objectContaining ( { value : 1 } ) ) ;
536536 expect ( enrichedSignals . hits . hits ) . toHaveLength ( 1 ) ;
537537
538538 const [ enrichedHit ] = enrichedSignals . hits . hits ;
539- const indicators = get ( enrichedHit . _source , DEFAULT_INDICATOR_PATH ) ;
539+ const indicators = get ( enrichedHit . _source , INDICATOR_DESTINATION_PATH ) ;
540540
541541 expect ( indicators ) . toEqual ( [
542542 {
0 commit comments