Skip to content

Commit

Permalink
test: Add test for upgrading same actions
Browse files Browse the repository at this point in the history
cf. #192
  • Loading branch information
liquidz committed Nov 10, 2023
1 parent d3f8787 commit 3efdfa0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/antq/upgrade/github_action_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
(r/map->Dependency {:project :github-action
:type :github-tag
:name "foo/bar"
:version "v1.0.0"
:latest-version "v9.0.0"
:file (io/resource "dep/test_github_action.yml")
:extra {const.gh-action/type-key "uses"}}))
Expand Down Expand Up @@ -77,10 +78,17 @@
(let [from-deps (->> (:file dummy-dep)
(slurp)
(dep.gha/extract-deps ""))
to-deps (->> dummy-dep
(upgrade/upgrader)
(dep.gha/extract-deps ""))]
(t/is (= #{{:name "foo/bar" :version {:- "v1.0.0" :+ "v9.0.0"}}}
temp-content (->> dummy-dep
(upgrade/upgrader))
to-deps (h/with-temp-file
[temp-file temp-content]
(->> (assoc dummy-dep
:version "v2.0.0"
:file temp-file)
(upgrade/upgrader)
(dep.gha/extract-deps "")))]
(t/is (= #{{:name "foo/bar" :version {:- "v1.0.0" :+ "v9.0.0"}}
{:name "foo/bar" :version {:- "v2.0.0" :+ "v9.0.0"}}}
(h/diff-deps from-deps to-deps)))))

(t/testing "not supported"
Expand Down
2 changes: 2 additions & 0 deletions test/resources/dep/test_github_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: foo/[email protected]
- name: Foo
uses: foo/[email protected]
- name: Bar
uses: bar/baz@master
- uses: ./
Expand Down

0 comments on commit 3efdfa0

Please sign in to comment.