Skip to content

Commit

Permalink
chore: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug committed Nov 1, 2023
1 parent 68632c2 commit e2dc74b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_actions/test_sync_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,26 @@ def test_analyze_repos_no_new_version() -> None:
result, _ = syncer.analyze_repos(pre_commit_repos, mapping, mapping_reverse_by_url)

assert result == {}


def test_analyze_repos_local() -> None:
printer = MagicMock(spec=Printer)
pre_commit_config_file_path = MagicMock(spec=Path)
locked_packages: dict[str, GenericLockedPackage] = {"lib_name": MagicMock(version="0.1.1+dev")}
plugin_config = MagicMock(spec=SyncPreCommitLockConfig)
plugin_config.ignore = []

syncer = SyncPreCommitHooksVersion(
printer=printer,
pre_commit_config_file_path=pre_commit_config_file_path,
locked_packages=locked_packages,
plugin_config=plugin_config,
)

pre_commit_repos = {PreCommitRepo("repo_url", "1.2.3")}
mapping = {"lib_name": RepoInfo(repo="repo_url", rev="${rev}")}
mapping_reverse_by_url = {"repo_url": "lib_name"}

result, _ = syncer.analyze_repos(pre_commit_repos, mapping, mapping_reverse_by_url)

assert result == {}

0 comments on commit e2dc74b

Please sign in to comment.