aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mason-registry/sources/collection_spec.lua
blob: b603c8683581da1dec5ecb8f507dd9df38a7ca30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
local LazySourceCollection = require "mason-registry.sources"

describe("LazySourceCollection", function()
    it("should dedupe registries on append/prepend", function()
        local coll = LazySourceCollection:new()

        coll:append "github:mason-org/mason-registry"
        coll:prepend "github:mason-org/mason-registry@2025-05-16"
        coll:prepend "github:my-own/registry"
        coll:prepend "lua:registry"
        coll:append "lua:registry"
        coll:append "file:~/registry"
        coll:append "file:$HOME/registry"

        assert.equals(4, coll:size())
        assert.same("lua:registry", coll:get(1):get_full_id())
        assert.same("github:my-own/registry", coll:get(2):get_full_id())
        assert.same("github:mason-org/mason-registry@2025-05-16", coll:get(3):get_full_id())
        assert.same("file:~/registry", coll:get(4):get_full_id())
    end)
end)