generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
162 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { CoveredProject } from '../src/lcov' | ||
import { buildMessage } from '../src/message' | ||
|
||
describe('buildMessage', () => { | ||
it('returns an empty string when projects array is empty', () => { | ||
const projects = [] | ||
const sha = 'abcdef1234567890' | ||
const result = buildMessage(projects, sha) | ||
expect(result).toEqual('') | ||
}) | ||
|
||
const projectA = { | ||
name: 'project_a', | ||
description: 'Description A', | ||
pubspecFile: 'packages/project_a/pubspec.yaml', | ||
coverage: [], | ||
coverageBefore: [], | ||
coverageFile: 'packages/project_a/coverage/lcov.info' | ||
} | ||
|
||
const projectB = { | ||
name: 'project_b', | ||
description: 'Description B', | ||
pubspecFile: 'packages/project_b/pubspec.yaml', | ||
coverage: [], | ||
coverageBefore: [], | ||
coverageFile: 'packages/project_b/coverage/lcov.info' | ||
} | ||
|
||
it('returns the correct message when projects array has one project', () => { | ||
const projects: CoveredProject[] = [projectA] | ||
const sha = 'abcdef1234567890' | ||
const result = buildMessage(projects, sha) | ||
expect(result).toEqual(expected1Project) | ||
}) | ||
|
||
it('returns the correct message when projects array has two projects', () => { | ||
const projects: CoveredProject[] = [projectA, projectB] | ||
const sha = 'abcdef1234567890' | ||
const result = buildMessage(projects, sha) | ||
expect(result).toEqual(expected2Projects) | ||
}) | ||
}) | ||
|
||
const expected1Project = `# Coverage Report | ||
This is an automatic coverage report for abcdef12, proudly generated by [Dart Coverage Assistant](https://github.com/whynotmake-it/dart-coverage-assistant) 🎯🧪. | ||
## \`project_a\` | ||
Description A | ||
![0% - fail](http://img.shields.io/badge/project_a-0.00%25-critical)\t➡️ 0.00% | ||
<details> | ||
<summary>Coverage Details for <strong>project_a</strong></summary> | ||
| File | Line Percentage | Line Count | | ||
| --- | --- | --- | | ||
</details> | ||
` | ||
|
||
const expected2Projects = `# Coverage Report | ||
This is an automatic coverage report for abcdef12, proudly generated by [Dart Coverage Assistant](https://github.com/whynotmake-it/dart-coverage-assistant) 🎯🧪. | ||
## Monorepo coverage | ||
This repository contains 2 Dart projects. This is is the total coverage across all of them: | ||
![0% - fail](http://img.shields.io/badge/0.00%25-critical)\t➡️ 0.00% | ||
## \`project_a\` | ||
Description A | ||
![0% - fail](http://img.shields.io/badge/project_a-0.00%25-critical)\t➡️ 0.00% | ||
<details> | ||
<summary>Coverage Details for <strong>project_a</strong></summary> | ||
| File | Line Percentage | Line Count | | ||
| --- | --- | --- | | ||
</details> | ||
## \`project_b\` | ||
Description B | ||
![0% - fail](http://img.shields.io/badge/project_b-0.00%25-critical)\t➡️ 0.00% | ||
<details> | ||
<summary>Coverage Details for <strong>project_b</strong></summary> | ||
| File | Line Percentage | Line Count | | ||
| --- | --- | --- | | ||
</details> | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters