diff options
| author | William Boman <william@redwill.se> | 2022-09-14 14:40:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-14 12:40:38 +0000 |
| commit | 07d949a21aff4c8a379a36ac3e457027efe3a1fe (patch) | |
| tree | 647563e13e936095bc49b94979317c30ec4a5081 /tests | |
| parent | chore: update generated code (#416) (diff) | |
| download | mason-07d949a21aff4c8a379a36ac3e457027efe3a1fe.tar mason-07d949a21aff4c8a379a36ac3e457027efe3a1fe.tar.gz mason-07d949a21aff4c8a379a36ac3e457027efe3a1fe.tar.bz2 mason-07d949a21aff4c8a379a36ac3e457027efe3a1fe.tar.lz mason-07d949a21aff4c8a379a36ac3e457027efe3a1fe.tar.xz mason-07d949a21aff4c8a379a36ac3e457027efe3a1fe.tar.zst mason-07d949a21aff4c8a379a36ac3e457027efe3a1fe.zip | |
fix(r-languageserver): use github releases as version source (#417)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/mason-core/managers/github_spec.lua | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/mason-core/managers/github_spec.lua b/tests/mason-core/managers/github_spec.lua index 7d44f144..c0285519 100644 --- a/tests/mason-core/managers/github_spec.lua +++ b/tests/mason-core/managers/github_spec.lua @@ -23,6 +23,10 @@ describe("github release file", function() end) assert.spy(client.fetch_latest_release).was_not_called() assert.equals("13.37", source.release) + assert.equals( + "https://github.com/williamboman/mason.nvim/releases/download/13.37/program.exe", + source.download_url + ) end) ) @@ -47,6 +51,49 @@ describe("github release file", function() assert.spy(client.fetch_latest_release).was_called_with "williamboman/mason.nvim" assert.equals("im_the_tag", source.release) assert.equals("im_the_tag_for_reals", source.asset_file) + assert.equals( + "https://github.com/williamboman/mason.nvim/releases/download/im_the_tag/im_the_tag_for_reals", + source.download_url + ) + end) + ) +end) + +describe("github release version", function() + it( + "should use provided version", + async_test(function() + stub(client, "fetch_latest_release") + local handle = InstallHandleGenerator "dummy" + local ctx = InstallContextGenerator(handle) + local source = installer.run_installer(ctx, function() + return github.release_version { + repo = "williamboman/mason.nvim", + version = Optional.of "13.37", + } + end) + assert.spy(client.fetch_latest_release).was_not_called() + assert.equals("13.37", source.release) + end) + ) + + it( + "should fetch latest release from GitHub API", + async_test(function() + async_test(function() + stub(client, "fetch_latest_release") + client.fetch_latest_release.returns(Result.success { tag_name = "v42" }) + local handle = InstallHandleGenerator "dummy" + local ctx = InstallContextGenerator(handle) + local source = installer.run_installer(ctx, function() + return github.release_version { + repo = "williamboman/mason.nvim", + } + end) + assert.spy(client.fetch_latest_release).was_called(1) + assert.spy(client.fetch_latest_release).was_called_with "williamboman/mason.nvim" + assert.equals("v42", source.release) + end) end) ) end) |
