serverlistmgr_spec.lua 938 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. _G.core = {}
  2. _G.unpack = table.unpack
  3. _G.check_cache_age = function() return false end
  4. _G.serverlistmgr = {}
  5. dofile("builtin/common/vector.lua")
  6. dofile("builtin/common/misc_helpers.lua")
  7. dofile("builtin/mainmenu/serverlistmgr.lua")
  8. local base = "builtin/mainmenu/tests/"
  9. describe("legacy favorites", function()
  10. it("loads well-formed correctly", function()
  11. local favs = serverlistmgr.read_legacy_favorites(base .. "favorites_wellformed.txt")
  12. local expected = {
  13. {
  14. address = "127.0.0.1",
  15. port = 30000,
  16. },
  17. { address = "localhost", port = 30000 },
  18. { address = "vps.rubenwardy.com", port = 30001 },
  19. { address = "gundul.ddnss.de", port = 39155 },
  20. {
  21. address = "daconcepts.com",
  22. port = 30000,
  23. name = "VanessaE's Dreambuilder creative Server",
  24. description = "VanessaE's Dreambuilder creative-mode server. Lots of mods, whitelisted buckets."
  25. },
  26. }
  27. assert.same(expected, favs)
  28. end)
  29. end)