def test_new_style_release_notes_patch(): """ In the conventional-commits template (see: https://github.com/conventional-changelog/conventional-changelog), patches are an H3 header and are linked to the underlying issue that created the release. """ expected = """### Bug Fixes * include 'x-goog-request-params' header in requests ([#167](https://www.github.com/googleapis/nodejs-os-login/issues/167)) ([074051d](https://www.github.com/googleapis/nodejs-os-login/commit/074051d))""" ctx = TagContext(release_version="v0.3.3") _get_latest_release_notes(ctx, fixture_new_and_old_style_changelog) assert ctx.release_notes == expected
def test_old_style_release_notes(): """ Our old CHANGELOG template does not make the version header a link and always uses H2 headers. """ expected = """03-13-2019 16:30 PDT ### Bug Fixes - fix: throw on invalid credentials ([#281](https://github.com/googleapis/nodejs-dialogflow/pull/281))""" ctx = TagContext(release_version="v0.8.2") _get_latest_release_notes(ctx, fixture_old_style_changelog) assert ctx.release_notes == expected
def test_extracts_appropriate_release_notes_when_prior_release_is_patch(): """ see: https://github.com/googleapis/release-please/issues/140 """ ctx = TagContext(release_version="v5.0.0") _get_latest_release_notes(ctx, fixture_new_style_patch) expected = """### ⚠ BREAKING CHANGES * temp directory now defaults to setting for report directory ### Features * default temp directory to report directory ([#102](https://www.github.com/bcoe/c8/issues/102)) ([8602f4a](https://www.github.com/bcoe/c8/commit/8602f4a)) * load .nycrc/.nycrc.json to simplify migration ([#100](https://www.github.com/bcoe/c8/issues/100)) ([bd7484f](https://www.github.com/bcoe/c8/commit/bd7484f))""" assert ctx.release_notes == expected
def test_new_style_release_notes_breaking(): """ in the conventional-commits template, features/breaking-changes use an H2 header. """ expected = """### Features * added the most amazing feature ever ([42f90e2](https://www.github.com/bcoe/examples-conventional-commits/commit/42f90e2)) * adds a fancy new feature ([c46bfa3](https://www.github.com/bcoe/examples-conventional-commits/commit/c46bfa3)) ### BREAKING CHANGES * this fancy new feature breaks things * disclaimer breaks everything""" ctx = TagContext(release_version="v2.0.0") _get_latest_release_notes(ctx, fixture_new_style_changelog) assert ctx.release_notes == expected