Skip to content

Commit

Permalink
♻️ More tests, more coverage, refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tiulpin committed Jun 17, 2023
1 parent f8bdb25 commit afce55d
Show file tree
Hide file tree
Showing 8 changed files with 1,352 additions and 1,821 deletions.
27 changes: 22 additions & 5 deletions scan/__tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import {expect, test} from '@jest/globals'
import {getQodanaScanArgs} from '../../common/qodana'
import {parseSarif, toAnnotationProperties} from '../src/annotations'
import {AnnotationProperties} from '@actions/core'
import {getQodanaScanArgs, Inputs} from '../../common/qodana'
import {
Annotation,
getGitHubCheckConclusion,
parseSarif,
toAnnotationProperties
} from '../src/annotations'
import {getSummary} from '../src/output'

test('qodana scan command args', () => {
Expand Down Expand Up @@ -52,9 +58,20 @@ test('check conversion from Checks API Annotations to actions/core AnnotationPro
expect(result).toEqual(annotationPropertyDefaultFixture())
})

import {Inputs} from '../../common/qodana'
import {Annotation} from '../src/annotations'
import {AnnotationProperties} from '@actions/core'
test('check failure conclusion for the Check', () => {
const result = getGitHubCheckConclusion(annotationsDefaultFixture(), true)
expect(result).toEqual('failure')
})

test('check neutral conclusion for the Check', () => {
const result = getGitHubCheckConclusion(annotationsDefaultFixture(), false)
expect(result).toEqual('neutral')
})

test('check success conclusion for the Check', () => {
const result = getGitHubCheckConclusion(outputEmptyFixture(), false)
expect(result).toEqual('success')
})

export function outputEmptyFixture(): Annotation[] {
return []
Expand Down
2 changes: 0 additions & 2 deletions scan/__tests__/project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import {expect, test} from '@jest/globals'
import {
sha256sum,
getQodanaSha256,
getQodanaScanArgs,
Inputs,
getQodanaUrl,
VERSION,
SUPPORTED_PLATFORMS,
Expand Down
917 changes: 459 additions & 458 deletions scan/dist/index.js

Large diffs are not rendered by default.

0 comments on commit afce55d

Please sign in to comment.