]> git.lizzy.rs Git - minetest.git/blob - builtin/mainmenu/tests/serverlistmgr_spec.lua
Take geographic distance into account for server list ordering (#12790)
[minetest.git] / builtin / mainmenu / tests / serverlistmgr_spec.lua
1 _G.core = {get_once = function(_) end}
2 _G.vector = {metatable = {}}
3 _G.unpack = table.unpack
4 _G.serverlistmgr = {}
5
6 dofile("builtin/common/vector.lua")
7 dofile("builtin/common/misc_helpers.lua")
8 dofile("builtin/mainmenu/serverlistmgr.lua")
9
10 local base = "builtin/mainmenu/tests/"
11
12 describe("legacy favorites", function()
13         it("loads well-formed correctly", function()
14                 local favs = serverlistmgr.read_legacy_favorites(base .. "favorites_wellformed.txt")
15
16                 local expected = {
17                         {
18                                 address = "127.0.0.1",
19                                 port = 30000,
20                         },
21
22                         { address = "localhost", port = 30000 },
23
24                         { address = "vps.rubenwardy.com", port = 30001 },
25
26                         { address = "gundul.ddnss.de", port = 39155 },
27
28                         {
29                                 address = "daconcepts.com",
30                                 port = 30000,
31                                 name = "VanessaE's Dreambuilder creative Server",
32                                 description = "VanessaE's Dreambuilder creative-mode server. Lots of mods, whitelisted buckets."
33                         },
34                 }
35
36                 assert.same(expected, favs)
37         end)
38 end)