Skip to content

Commit 20701b3

Browse files
committed
fix tests
1 parent 0b6e441 commit 20701b3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/plugin-junit/src/__tests__/upload.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ const CWD = upath.normalize(process.cwd())
1717

1818
describe('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
})

packages/plugin-sarif/src/__tests__/upload.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ const CWD = upath.normalize(process.cwd())
5858

5959
describe('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
})

0 commit comments

Comments
 (0)