File tree Expand file tree Collapse file tree
plugin-junit/src/__tests__
plugin-sarif/src/__tests__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,12 +17,12 @@ const CWD = upath.normalize(process.cwd())
1717
1818describe ( 'upload' , ( ) => {
1919 describe ( 'getApiHelper' , ( ) => {
20- test ( 'should throw an error if API key is undefined' , ( ) => {
20+ test ( 'should throw an error if API key is undefined' , async ( ) => {
2121 process . env = { }
2222 const write = jest . fn ( )
2323 const command = createCommand ( JunitUploadCommand , { stdout : { write} } )
2424
25- expect ( command [ 'getApiHelper' ] . bind ( command ) ) . toThrow ( 'API key is missing' )
25+ await expect ( command [ 'getApiHelper' ] ( ) ) . rejects . toThrow ( 'API key is missing' )
2626 expect ( write . mock . calls [ 0 ] [ 0 ] ) . toContain ( 'DD_API_KEY' )
2727 } )
2828 } )
Original file line number Diff line number Diff line change @@ -58,12 +58,12 @@ const CWD = upath.normalize(process.cwd())
5858
5959describe ( 'upload' , ( ) => {
6060 describe ( 'getApiHelper' , ( ) => {
61- test ( 'should throw an error if API key is undefined' , ( ) => {
61+ test ( 'should throw an error if API key is undefined' , async ( ) => {
6262 process . env = { }
6363 const write = jest . fn ( )
6464 const command = createCommand ( SarifUploadCommand , { stdout : { write} } )
6565
66- expect ( command [ 'getApiHelper' ] . bind ( command ) ) . toThrow ( 'API key is missing' )
66+ await expect ( command [ 'getApiHelper' ] ( ) ) . rejects . toThrow ( 'API key is missing' )
6767 expect ( write . mock . calls [ 0 ] [ 0 ] ) . toContain ( 'DATADOG_API_KEY' )
6868 } )
6969 } )
You can’t perform that action at this time.
0 commit comments