Skip to content

Commit

Permalink
test: fix new strings in the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mheob committed Apr 13, 2023
1 parent 7fcecaf commit c1b3ec6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/getReleaseLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export const getReleaseLine: GetReleaseLine = async (changeset, _type, options)
.split('\n')
.map((line) => linkifyIssue(line.trimEnd(), options['repo']));

const prMessage = pull ? `(${pull})` : '';
const commitMessage = commit ? `(${commit})` : '';
const prMessage = pull ? `${pull}` : '';
const commitMessage = commit ? `${commit}` : '';
// istanbul ignore next: because of our mocked get-github-info -- @preserve
const printPrOrCommit = (pull !== '' ? prMessage : commitMessage).trim();
const prefix = printPrOrCommit ? `${printPrOrCommit} ${userLink}: ` : '';
Expand Down
6 changes: 3 additions & 3 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@ describe('getReplacedChangelog', () => {
);
const result = await getReleaseLine(changeset, 'minor', { repo: data.repo });
expect(result).toBe(
'\n\n- An awesome feature. --> ([#2](https://github.com/mheob/changeset-changelog/pull/2)) by [@mheob](https://github.com/mheob)\n',
'\n\n- [#2](https://github.com/mheob/changeset-changelog/pull/2) ([@mheob](https://github.com/mheob)): An awesome feature.\n',
);
});

it('should return the changelog in a string format with data from commit', async () => {
const changeset = getChangeset('An awesome feature.', data.commit);
const result = await getReleaseLine(changeset, 'minor', { repo: data.repo });
expect(result).toBe(
'\n\n- An awesome feature. --> ([#2](https://github.com/mheob/changeset-changelog/pull/2)) by [@mheob](https://github.com/mheob)\n',
'\n\n- [#2](https://github.com/mheob/changeset-changelog/pull/2) ([@mheob](https://github.com/mheob)): An awesome feature.\n',
);
});

it('should return the changelog in a string format with data from commit', async () => {
const changeset = getChangeset('An awesome feature, (resolves #9)', data.commit);
const result = await getReleaseLine(changeset, 'minor', { repo: data.repo });
expect(result).toBe(
'\n\n- An awesome feature, (resolves [#9](https://github.com/mheob/changeset-changelog/issues/9)) --> ([#2](https://github.com/mheob/changeset-changelog/pull/2)) by [@mheob](https://github.com/mheob)\n',
'\n\n- [#2](https://github.com/mheob/changeset-changelog/pull/2) ([@mheob](https://github.com/mheob)): An awesome feature, (resolves [#9](https://github.com/mheob/changeset-changelog/issues/9))\n',
);
});

Expand Down

0 comments on commit c1b3ec6

Please sign in to comment.