Skip to content

Commit

Permalink
chore: add test for updateChangelog
Browse files Browse the repository at this point in the history
  • Loading branch information
legobeat committed Oct 29, 2024
1 parent f7a0f10 commit 091dd8d
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/update-changelog.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import _outdent from 'outdent';

import { updateChangelog } from './update-changelog';

const outdent = _outdent({ trimTrailingNewline: false });

describe('updateChangelog', () => {
it('should call git fetch by default', () => {
const cmdMock = jest.fn();
updateChangelog({

Check failure on line 10 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check failure on line 10 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (20.x)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
changelogContent: outdent`
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
[Unreleased]:https://github.com/ExampleUsernameOrOrganization/ExampleRepository/
`,
isReleaseCandidate: true,
repoUrl:
'https://github.com/ExampleUsernameOrOrganization/ExampleRepository',
run: cmdMock,
});
expect(cmdMock).toHaveBeenCalledWith('git', ['fetch', '--tags'])

Check failure on line 27 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Insert `;`

Check failure on line 27 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (20.x)

Insert `;`
});
it('should not call git fetch when ', () => {

Check failure on line 29 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (18.x)

should not have leading or trailing spaces

Check failure on line 29 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (20.x)

should not have leading or trailing spaces
const cmdMock = jest.fn();
updateChangelog({

Check failure on line 31 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check failure on line 31 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (20.x)

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
changelogContent: outdent`
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
[Unreleased]:https://github.com/ExampleUsernameOrOrganization/ExampleRepository/
`,
isReleaseCandidate: true,
repoUrl:
'https://github.com/ExampleUsernameOrOrganization/ExampleRepository',
fetchRemote: false,
run: cmdMock,
});
expect(cmdMock).not.toHaveBeenCalledWith(['git'], ['fetch', '--tags'])

Check failure on line 49 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (18.x)

Insert `;`

Check failure on line 49 in src/update-changelog.test.ts

View workflow job for this annotation

GitHub Actions / Lint (20.x)

Insert `;`
});
});

0 comments on commit 091dd8d

Please sign in to comment.