@@ -15,7 +15,7 @@ describe('dataScraper()', () => {
1515 delete config . SYSDIG_TOKEN ;
1616 } ) ;
1717
18- it ( 'correctly sends data to kubernetes-upstream' , async ( jestDoneCallback ) => {
18+ it ( 'correctly sends data to kubernetes-upstream' , async ( ) => {
1919 const bodyWithToken = {
2020 data : [
2121 {
@@ -63,51 +63,42 @@ describe('dataScraper()', () => {
6363 . post ( '/api/v1/runtime-results' )
6464 . times ( 1 )
6565 . reply ( 200 , ( uri , requestBody : transmitterTypes . IRuntimeDataPayload ) => {
66- try {
67- expect ( requestBody ) . toEqual < transmitterTypes . IRuntimeDataPayload > ( {
68- identity : {
69- type : 'sysdig' ,
66+ expect ( requestBody ) . toEqual < transmitterTypes . IRuntimeDataPayload > ( {
67+ identity : {
68+ type : 'sysdig' ,
69+ } ,
70+ target : {
71+ userLocator : expect . any ( String ) ,
72+ cluster : 'Default cluster' ,
73+ agentId : expect . any ( String ) ,
74+ } ,
75+ facts : [
76+ {
77+ type : 'loadedPackages' ,
78+ data : bodyWithToken . data ,
7079 } ,
71- target : {
72- userLocator : expect . any ( String ) ,
73- cluster : 'Default cluster' ,
74- agentId : expect . any ( String ) ,
75- } ,
76- facts : [
77- {
78- type : 'loadedPackages' ,
79- data : bodyWithToken . data ,
80- } ,
81- ] ,
82- } ) ;
83- } catch ( error ) {
84- jestDoneCallback ( error ) ;
85- }
80+ ] ,
81+ } ) ;
8682 } )
8783 . post ( '/api/v1/runtime-results' )
8884 . times ( 1 )
8985 . reply ( 200 , ( uri , requestBody : transmitterTypes . IRuntimeDataPayload ) => {
90- try {
91- expect ( requestBody ) . toEqual < transmitterTypes . IRuntimeDataPayload > ( {
92- identity : {
93- type : 'sysdig' ,
94- } ,
95- target : {
96- userLocator : expect . any ( String ) ,
97- cluster : 'Default cluster' ,
98- agentId : expect . any ( String ) ,
86+ expect ( requestBody ) . toEqual < transmitterTypes . IRuntimeDataPayload > ( {
87+ identity : {
88+ type : 'sysdig' ,
89+ } ,
90+ target : {
91+ userLocator : expect . any ( String ) ,
92+ cluster : 'Default cluster' ,
93+ agentId : expect . any ( String ) ,
94+ } ,
95+ facts : [
96+ {
97+ type : 'loadedPackages' ,
98+ data : bodyNoToken . data ,
9999 } ,
100- facts : [
101- {
102- type : 'loadedPackages' ,
103- data : bodyNoToken . data ,
104- } ,
105- ] ,
106- } ) ;
107- jestDoneCallback ( ) ;
108- } catch ( error ) {
109- jestDoneCallback ( error ) ;
110- }
100+ ] ,
101+ } ) ;
111102 } ) ;
112103
113104 await scrapeData ( ) ;
0 commit comments