# Path: releasetool/commands/tag/nodejs.py
# def _get_latest_release_notes(ctx: TagContext, changelog: str):
#     # the 'v' prefix is not used in the conventional-changelog templates
#     # used in automated CHANGELOG generation:
#     version = re.sub(r"^v", "", ctx.release_version)
#     match = re.search(
#         rf"## v?\[?{version}[^\n]*\n(?P<notes>.+?)(\n##\s|\n### \[?[0-9]+\.|\Z)",
#         changelog,
#         re.DOTALL | re.MULTILINE,
#     )
#     if match is not None:
#         ctx.release_notes = match.group("notes").strip()
#     else:
#         ctx.release_notes = ""
# 
# def kokoro_job_name(upstream_repo: str, package_name: str) -> Union[str, None]:
#     """Return the Kokoro job name.
# 
#     Args:
#         upstream_repo (str): The GitHub repo in the form of `<owner>/<repo>`
#         package_name (str): The name of package to release
# 
#     Returns:
#         The name of the Kokoro job to trigger or None if there is no job to trigger
#     """
#     return f"cloud-devrel/client-libraries/nodejs/release/{upstream_repo}/publish"
# 
# def package_name(pull: dict) -> Union[str, None]:
#     return None
# 
# Path: releasetool/commands/common.py
# class TagContext(GitHubContext):
#     release_pr: Optional[dict] = None
#     release_tag: Optional[str] = None
#     release_version: Optional[str] = None
#     github_release: Optional[dict] = None
#     kokoro_job_name: Optional[str] = None
#     fusion_url: Optional[str] = None
#     token: Optional[str] = None


from releasetool.commands.tag.nodejs import (
    _get_latest_release_notes,
    kokoro_job_name,
    package_name,
)
from releasetool.commands.common import TagContext
* 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))

### [4.1.5](https://github.com/bcoe/c8/compare/v4.1.4...v4.1.5) (2019-05-11)


### Bug Fixes

* exit with code 1 when report output fails ([#92](https://github.com/bcoe/c8/issues/92)) ([a27b694](https://github.com/bcoe/c8/commit/a27b694))
* remove the unmaintained mkdirp dependency ([#91](https://github.com/bcoe/c8/issues/91)) ([a465b65](https://github.com/bcoe/c8/commit/a465b65))



## [4.1.4](https://github.com/bcoe/c8/compare/v4.1.3...v4.1.4) (2019-05-03)


### Bug Fixes

* we were not exiting with 1 if mkdir failed ([#89](https://github.com/bcoe/c8/issues/89)) ([fb02ed6](https://github.com/bcoe/c8/commit/fb02ed6))
"""


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))"""

# Path: releasetool/commands/tag/nodejs.py
# def _get_latest_release_notes(ctx: TagContext, changelog: str):
#     # the 'v' prefix is not used in the conventional-changelog templates
#     # used in automated CHANGELOG generation:
#     version = re.sub(r"^v", "", ctx.release_version)
#     match = re.search(
#         rf"## v?\[?{version}[^\n]*\n(?P<notes>.+?)(\n##\s|\n### \[?[0-9]+\.|\Z)",
#         changelog,
#         re.DOTALL | re.MULTILINE,
#     )
#     if match is not None:
#         ctx.release_notes = match.group("notes").strip()
#     else:
#         ctx.release_notes = ""
# 
# def kokoro_job_name(upstream_repo: str, package_name: str) -> Union[str, None]:
#     """Return the Kokoro job name.
# 
#     Args:
#         upstream_repo (str): The GitHub repo in the form of `<owner>/<repo>`
#         package_name (str): The name of package to release
# 
#     Returns:
#         The name of the Kokoro job to trigger or None if there is no job to trigger
#     """
#     return f"cloud-devrel/client-libraries/nodejs/release/{upstream_repo}/publish"
# 
# def package_name(pull: dict) -> Union[str, None]:
#     return None
# 
# Path: releasetool/commands/common.py
# class TagContext(GitHubContext):
#     release_pr: Optional[dict] = None
#     release_tag: Optional[str] = None
#     release_version: Optional[str] = None
#     github_release: Optional[dict] = None
#     kokoro_job_name: Optional[str] = None
#     fusion_url: Optional[str] = None
#     token: Optional[str] = None


# Path: tests/commands/tag/test_tag_nodejs.py
from releasetool.commands.tag.nodejs import (
    _get_latest_release_notes,
    kokoro_job_name,
    package_name,
)
from releasetool.commands.common import TagContext

* 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))

### [4.1.5](https://github.com/bcoe/c8/compare/v4.1.4...v4.1.5) (2019-05-11)


### Bug Fixes

* exit with code 1 when report output fails ([#92](https://github.com/bcoe/c8/issues/92)) ([a27b694](https://github.com/bcoe/c8/commit/a27b694))
* remove the unmaintained mkdirp dependency ([#91](https://github.com/bcoe/c8/issues/91)) ([a465b65](https://github.com/bcoe/c8/commit/a465b65))



## [4.1.4](https://github.com/bcoe/c8/compare/v4.1.3...v4.1.4) (2019-05-03)


### Bug Fixes

* we were not exiting with 1 if mkdir failed ([#89](https://github.com/bcoe/c8/issues/89)) ([fb02ed6](https://github.com/bcoe/c8/commit/fb02ed6))
"""


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")