stefanzweifel / git-auto-commit-action

Automatically commit and push changed files back to GitHub with this GitHub Action for the 80% use case.
MIT License
1.98k stars 227 forks source link

Rewrite Test Suite to no longer mock git #128

Closed stefanzweifel closed 3 years ago

stefanzweifel commented 3 years ago

After many hours I've found the perfect solution to test this Action: Local "remote" repositories.

I didn't like the tests I've added in #100 and #109 since the beginning: I had to mock all calls to git which lead to many frustrations. It also didn't gave me the confidence that the Action actually did what it should The docs for shellmock are also sparse and are quite confusing for a newcomer to bash testing like me.

This PR solves all of this problem by simply using a remote repository which is located on the same file system. A remote repository doesn't have to be hosted on GitHub or another website, but can simply sit on the same file system.

This solves quite a lot of problems:

I still have some open TODOs where I would like to write better assertions to make sure that git actually did what we want. (And not just assert again what we echo in the script)

This PR will also fix #112 as shellmock is no longer a dependency.

TODOs

OskarStark commented 3 years ago

Smart solution πŸ‘ŒπŸ» congrats πŸŽ‰