Skip to content

Commit

Permalink
no need to test param is required
Browse files Browse the repository at this point in the history
  • Loading branch information
masci committed Jan 31, 2024
1 parent 8ef869f commit 1549e52
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {run} from '../src/run'
import * as dd from '../src/datadog'
import * as process from 'process'
import * as core from '@actions/core'
import * as cp from 'child_process'
import * as path from 'path'
import * as yaml from 'js-yaml'
import {getHeapStatistics} from 'v8'
import * as path from 'path'
import * as process from 'process'
import * as dd from '../src/datadog'
import {run} from '../src/run'
jest.mock('../src/datadog')

describe('unit-tests', () => {
Expand All @@ -21,18 +19,6 @@ describe('unit-tests', () => {
jest.clearAllMocks()
})

test('api-key input param must be set', async () => {
process.env['INPUT_API-KEY'] = ''
await run()
expect(dd.sendMetrics).toHaveBeenCalledTimes(0)
expect(dd.sendEvents).toHaveBeenCalledTimes(0)
expect(dd.sendServiceChecks).toHaveBeenCalledTimes(0)
expect(dd.sendLogs).toHaveBeenCalledTimes(0)
expect(outSpy).toHaveBeenCalledWith(
'::error::Run failed: Input required and not supplied: api-key\n'
)
})

test('default api endpoint URL', async () => {
await run()
expect(dd.sendMetrics).toHaveBeenCalledWith(
Expand Down

0 comments on commit 1549e52

Please sign in to comment.