aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-core
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2022-10-06 19:04:13 +0200
committerGitHub <noreply@github.com>2022-10-06 19:04:13 +0200
commitfb73733bff0e232a1a7cc7a3311ac0a59fd0448a (patch)
tree06c943591f9da1be64f1258b84c606b5397e348b /tests/mason-core
parentfix(pip3): expand python3_host_prog path (#519) (diff)
downloadmason-fb73733bff0e232a1a7cc7a3311ac0a59fd0448a.tar
mason-fb73733bff0e232a1a7cc7a3311ac0a59fd0448a.tar.gz
mason-fb73733bff0e232a1a7cc7a3311ac0a59fd0448a.tar.bz2
mason-fb73733bff0e232a1a7cc7a3311ac0a59fd0448a.tar.lz
mason-fb73733bff0e232a1a7cc7a3311ac0a59fd0448a.tar.xz
mason-fb73733bff0e232a1a7cc7a3311ac0a59fd0448a.tar.zst
mason-fb73733bff0e232a1a7cc7a3311ac0a59fd0448a.zip
feat(github): use proxy API for fetching latest release (#521)
This uses a globally distributed, edge-cached, proxy [1] for a very common touchpoint with the GitHub API. This is already done for fetching the latest tag, now expanding to latest release as well. [1]: https://github.com/williamboman/github-api-proxy
Diffstat (limited to 'tests/mason-core')
-rw-r--r--tests/mason-core/managers/github_client_spec.lua39
1 files changed, 0 insertions, 39 deletions
diff --git a/tests/mason-core/managers/github_client_spec.lua b/tests/mason-core/managers/github_client_spec.lua
index 8dec1ca8..16a923e0 100644
--- a/tests/mason-core/managers/github_client_spec.lua
+++ b/tests/mason-core/managers/github_client_spec.lua
@@ -1,48 +1,9 @@
-local spy = require "luassert.spy"
local stub = require "luassert.stub"
local client = require "mason-core.managers.github.client"
local spawn = require "mason-core.spawn"
local Result = require "mason-core.result"
describe("github client", function()
- ---@type GitHubRelease
- local release = {
- tag_name = "v0.1.0",
- prerelease = false,
- draft = false,
- assets = {},
- }
-
- local function stub_release(mock)
- return setmetatable(mock, { __index = release })
- end
-
- it("should identify stable prerelease", function()
- local predicate = client.release_predicate {
- include_prerelease = false,
- }
-
- assert.is_false(predicate(stub_release { prerelease = true }))
- assert.is_true(predicate(stub_release { prerelease = false }))
- end)
-
- it("should identify stable release with tag name pattern", function()
- local predicate = client.release_predicate {
- tag_name_pattern = "^lsp%-server.*$",
- }
-
- assert.is_false(predicate(stub_release { tag_name = "v0.1.0" }))
- assert.is_true(predicate(stub_release { tag_name = "lsp-server-v0.1.0" }))
- end)
-
- it("should identify stable release", function()
- local predicate = client.release_predicate {}
-
- assert.is_true(predicate(stub_release { tag_name = "v0.1.0" }))
- assert.is_false(predicate(stub_release { prerelease = true }))
- assert.is_false(predicate(stub_release { draft = true }))
- end)
-
it("should provide query parameters in api calls", function()
stub(spawn, "gh")
spawn.gh.returns(Result.success { stdout = "response data" })