mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-14 02:11:55 -04:00
add v1 and v2 player db examples and migration test
This commit is contained in:
parent
a5caecf96e
commit
48fa4b04f8
7 changed files with 69 additions and 31 deletions
28
migrate.spec.lua
Normal file
28
migrate.spec.lua
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
mtt.register("migrate v1", function(callback)
|
||||
local entry = mail.get_storage_entry("old_v1_player")
|
||||
assert(entry)
|
||||
assert(#entry.inbox == 1)
|
||||
assert(entry.inbox[1].from == "singleplayer")
|
||||
assert(entry.inbox[1].to == "old_v1_player")
|
||||
assert(entry.inbox[1].subject == "test1")
|
||||
assert(entry.inbox[1].body == "test2")
|
||||
assert(entry.inbox[1].id)
|
||||
assert(entry.inbox[1].time > 0)
|
||||
|
||||
callback()
|
||||
end)
|
||||
|
||||
mtt.register("migrate v2", function(callback)
|
||||
local entry = mail.get_storage_entry("old_v2_player")
|
||||
assert(entry)
|
||||
assert(#entry.inbox == 1)
|
||||
assert(entry.inbox[1].from == "someone-else")
|
||||
assert(entry.inbox[1].to == "old_v2_player")
|
||||
assert(entry.inbox[1].subject == "test1")
|
||||
assert(entry.inbox[1].body == "test2")
|
||||
assert(entry.inbox[1].id)
|
||||
assert(entry.inbox[1].time == 1678467148)
|
||||
|
||||
callback()
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue