aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu/tests/serverlistmgr_spec.lua
blob: a091959fbbf45bca91fa74349e030c6f3e397a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
_G.core = {}
_G.unpack = table.unpack
_G.serverlistmgr = {}

dofile("builtin/common/vector.lua")
dofile("builtin/common/misc_helpers.lua")
dofile("builtin/mainmenu/serverlistmgr.lua")

local base = "builtin/mainmenu/tests/"

describe("legacy favorites", function()
	it("loads well-formed correctly", function()
		local favs = serverlistmgr.read_legacy_favorites(base .. "favorites_wellformed.txt")

		local expected = {
			{
				address = "127.0.0.1",
				port = 30000,
			},

			{ address = "localhost", port = 30000 },

			{ address = "vps.rubenwardy.com", port = 30001 },

			{ address = "gundul.ddnss.de", port = 39155 },

			{
				address = "daconcepts.com",
				port = 30000,
				name = "VanessaE's Dreambuilder creative Server",
				description = "VanessaE's Dreambuilder creative-mode server. Lots of mods, whitelisted buckets."
			},
		}

		assert.same(expected, favs)
	end)
end)