@quenty/saveslot 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +18 -17
- package/src/Client/Binders/HasSaveSlotsClient.spec.lua +4 -14
- package/src/Server/Binders/HasSaveSlots.Code.spec.lua +20 -7
- package/src/Server/Binders/HasSaveSlots.ExportImport.spec.lua +18 -10
- package/src/Server/Binders/HasSaveSlots.PreSelect.spec.lua +21 -33
- package/src/Server/Binders/HasSaveSlots.SharedStore.spec.lua +18 -7
- package/src/Server/Binders/HasSaveSlots.TransferableEphemeral.spec.lua +18 -7
- package/src/Server/Binders/HasSaveSlots.spec.lua +181 -171
- package/src/Server/Cmdr/SaveSlotCmdrService.spec.lua +23 -18
- package/src/Server/HasSaveSlotsDataStore.lua +1 -1
- package/src/Server/OfflineSaveSlots.spec.lua +12 -7
- package/src/Server/{SaveSlotLateSettle.spec.lua → SaveSlotService.LateSettle.spec.lua} +61 -76
- package/src/Server/SaveSlotService.LoadFlow.spec.lua +117 -0
- package/src/Server/SaveSlotService.Overflow.spec.lua +112 -0
- package/src/Server/{SaveSlotPlaytime.spec.lua → SaveSlotService.Playtime.spec.lua} +23 -13
- package/src/Server/SaveSlotService.spec.lua +37 -32
- package/src/Server/SaveSlotSharedDataStoreService.spec.lua +14 -7
- package/src/Shared/Data/SaveSlotData.spec.lua +1 -1
- package/src/Server/SaveSlotLoadFlow.spec.lua +0 -151
- package/src/Server/SaveSlotOverflow.spec.lua +0 -125
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.11.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/saveslot@2.10.0...@quenty/saveslot@2.11.0) (2026-08-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/saveslot
|
|
9
|
+
|
|
6
10
|
# [2.10.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/saveslot@2.9.1...@quenty/saveslot@2.10.0) (2026-08-28)
|
|
7
11
|
|
|
8
12
|
**Note:** Version bump only for package @quenty/saveslot
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/saveslot",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "PlayerDataStoreService wrapper for save slots",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,34 +28,35 @@
|
|
|
28
28
|
"Quenty"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/adorneedata": "7.
|
|
32
|
-
"@quenty/attributeutils": "14.
|
|
31
|
+
"@quenty/adorneedata": "7.43.0",
|
|
32
|
+
"@quenty/attributeutils": "14.38.0",
|
|
33
33
|
"@quenty/baseobject": "10.16.0",
|
|
34
|
-
"@quenty/binder": "14.
|
|
35
|
-
"@quenty/brio": "14.
|
|
36
|
-
"@quenty/cmdrservice": "13.
|
|
37
|
-
"@quenty/datastore": "13.
|
|
38
|
-
"@quenty/instanceutils": "13.
|
|
34
|
+
"@quenty/binder": "14.45.0",
|
|
35
|
+
"@quenty/brio": "14.37.0",
|
|
36
|
+
"@quenty/cmdrservice": "13.60.0",
|
|
37
|
+
"@quenty/datastore": "13.55.0",
|
|
38
|
+
"@quenty/instanceutils": "13.37.0",
|
|
39
|
+
"@quenty/jestutils": "1.1.0",
|
|
39
40
|
"@quenty/loader": "10.11.1",
|
|
40
41
|
"@quenty/maid": "3.12.0",
|
|
41
42
|
"@quenty/nevermore-test-runner": "1.6.0",
|
|
42
|
-
"@quenty/observablecollection": "12.
|
|
43
|
-
"@quenty/playerbinder": "14.
|
|
44
|
-
"@quenty/playermock": "1.
|
|
43
|
+
"@quenty/observablecollection": "12.50.0",
|
|
44
|
+
"@quenty/playerbinder": "14.48.0",
|
|
45
|
+
"@quenty/playermock": "1.8.0",
|
|
45
46
|
"@quenty/promise": "10.24.0",
|
|
46
|
-
"@quenty/propertyvalue": "7.
|
|
47
|
-
"@quenty/remoting": "12.
|
|
47
|
+
"@quenty/propertyvalue": "7.37.0",
|
|
48
|
+
"@quenty/remoting": "12.43.0",
|
|
48
49
|
"@quenty/rx": "13.34.0",
|
|
49
50
|
"@quenty/servicebag": "11.21.0",
|
|
50
51
|
"@quenty/signal": "7.13.2",
|
|
51
52
|
"@quenty/table": "3.9.2",
|
|
52
|
-
"@quenty/teleportserviceutils": "10.
|
|
53
|
-
"@quenty/tie": "10.
|
|
54
|
-
"@quenty/valueobject": "13.
|
|
53
|
+
"@quenty/teleportserviceutils": "10.5.0",
|
|
54
|
+
"@quenty/tie": "10.49.0",
|
|
55
|
+
"@quenty/valueobject": "13.38.0",
|
|
55
56
|
"@quentystudios/jest-lua": "3.10.0-quenty.2"
|
|
56
57
|
},
|
|
57
58
|
"publishConfig": {
|
|
58
59
|
"access": "public"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "346201e192e467cb71160f43029863853be855b5"
|
|
61
62
|
}
|
|
@@ -9,6 +9,7 @@ local Workspace = game:GetService("Workspace")
|
|
|
9
9
|
local HasSaveSlotsClient = require("HasSaveSlotsClient")
|
|
10
10
|
local HasSaveSlotsInterface = require("HasSaveSlotsInterface")
|
|
11
11
|
local Jest = require("Jest")
|
|
12
|
+
local JestUtils = require("JestUtils")
|
|
12
13
|
local Maid = require("Maid")
|
|
13
14
|
local PlayerMock = require("PlayerMock")
|
|
14
15
|
local PromiseTestUtils = require("PromiseTestUtils")
|
|
@@ -18,27 +19,16 @@ local TeleportDataServiceClient = require("TeleportDataServiceClient")
|
|
|
18
19
|
local TieRealmService = require("TieRealmService")
|
|
19
20
|
local TieRealms = require("TieRealms")
|
|
20
21
|
|
|
21
|
-
local afterEach = Jest.Globals.afterEach
|
|
22
22
|
local describe = Jest.Globals.describe
|
|
23
23
|
local expect = Jest.Globals.expect
|
|
24
24
|
local it = Jest.Globals.it
|
|
25
25
|
|
|
26
26
|
local FAKE_USER_ID = 424242
|
|
27
27
|
|
|
28
|
-
local activeMaid: Maid.Maid? = nil
|
|
29
|
-
|
|
30
|
-
afterEach(function()
|
|
31
|
-
if activeMaid then
|
|
32
|
-
local maid = activeMaid
|
|
33
|
-
activeMaid = nil
|
|
34
|
-
maid:DoCleaning()
|
|
35
|
-
end
|
|
36
|
-
PlayerMock.setMockedLocalPlayer(nil)
|
|
37
|
-
end)
|
|
38
|
-
|
|
39
28
|
local function setup(): (Maid.Maid, any, any)
|
|
40
29
|
local maid = Maid.new()
|
|
41
|
-
|
|
30
|
+
|
|
31
|
+
maid:GiveTask(JestUtils.afterThis(maid))
|
|
42
32
|
|
|
43
33
|
local serviceBag = maid:Add(ServiceBag.new())
|
|
44
34
|
local tieRealmService = serviceBag:GetService(TieRealmService) :: any
|
|
@@ -59,7 +49,7 @@ local function newPlayerMock(maid: Maid.Maid, isLocalPlayer: boolean): Player
|
|
|
59
49
|
playerMock:Destroy()
|
|
60
50
|
end)
|
|
61
51
|
if isLocalPlayer then
|
|
62
|
-
PlayerMock.setMockedLocalPlayer(playerMock)
|
|
52
|
+
maid:GiveTask(PlayerMock.setMockedLocalPlayer(playerMock))
|
|
63
53
|
end
|
|
64
54
|
return playerMock
|
|
65
55
|
end
|
|
@@ -10,6 +10,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
10
10
|
local DataStoreMock = require("DataStoreMock")
|
|
11
11
|
local DataStoreTestUtils = require("DataStoreTestUtils")
|
|
12
12
|
local Jest = require("Jest")
|
|
13
|
+
local JestUtils = require("JestUtils")
|
|
14
|
+
local Maid = require("Maid")
|
|
13
15
|
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
14
16
|
local PlayerMock = require("PlayerMock")
|
|
15
17
|
local PromiseTestUtils = require("PromiseTestUtils")
|
|
@@ -27,6 +29,8 @@ local it = Jest.Globals.it
|
|
|
27
29
|
local FAKE_USER_ID = 424242
|
|
28
30
|
|
|
29
31
|
local function setup()
|
|
32
|
+
local maid = Maid.new()
|
|
33
|
+
|
|
30
34
|
local playerMock = DataStoreMock.new()
|
|
31
35
|
local sharedMock = DataStoreMock.new()
|
|
32
36
|
|
|
@@ -48,22 +52,31 @@ local function setup()
|
|
|
48
52
|
local hasSaveSlots = assert(binder:Bind(fakePlayer), "Failed to bind HasSaveSlots")
|
|
49
53
|
hasSaveSlots.MaxSlotCount.Value = 5
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-- this spec and fires inside a later package's window.
|
|
55
|
+
-- A PlayerMock never fires the real Players.PlayerRemoving, and the store the spec loaded is only
|
|
56
|
+
-- destroyed by a removal, so shut it down the way Roblox does or its auto-save loop outlives this spec.
|
|
57
|
+
maid:GiveTask(function()
|
|
55
58
|
DataStoreTestUtils.awaitServiceShutdown(playerDataStoreService)
|
|
56
59
|
fakePlayer:Destroy()
|
|
57
60
|
serviceBag:Destroy()
|
|
58
|
-
end
|
|
61
|
+
end)
|
|
62
|
+
|
|
63
|
+
local controller = {
|
|
64
|
+
hasSaveSlots = hasSaveSlots,
|
|
65
|
+
sharedMock = sharedMock,
|
|
66
|
+
Destroy = function(_self)
|
|
67
|
+
maid:DoCleaning()
|
|
68
|
+
end,
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
maid:GiveTask(JestUtils.afterThis(controller))
|
|
59
72
|
|
|
60
|
-
return
|
|
73
|
+
return controller
|
|
61
74
|
end
|
|
62
75
|
|
|
63
76
|
local function runWithContext(body)
|
|
64
77
|
local context = setup()
|
|
65
78
|
local ok, err = pcall(body, context)
|
|
66
|
-
context
|
|
79
|
+
context:Destroy()
|
|
67
80
|
if not ok then
|
|
68
81
|
error(err, 0)
|
|
69
82
|
end
|
|
@@ -11,6 +11,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
11
11
|
local DataStoreMock = require("DataStoreMock")
|
|
12
12
|
local DataStoreTestUtils = require("DataStoreTestUtils")
|
|
13
13
|
local Jest = require("Jest")
|
|
14
|
+
local JestUtils = require("JestUtils")
|
|
15
|
+
local Maid = require("Maid")
|
|
14
16
|
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
15
17
|
local PlayerMock = require("PlayerMock")
|
|
16
18
|
local PromiseTestUtils = require("PromiseTestUtils")
|
|
@@ -26,6 +28,8 @@ local it = Jest.Globals.it
|
|
|
26
28
|
local FAKE_USER_ID = 424242
|
|
27
29
|
|
|
28
30
|
local function setup()
|
|
31
|
+
local maid = Maid.new()
|
|
32
|
+
|
|
29
33
|
local mock = DataStoreMock.new()
|
|
30
34
|
|
|
31
35
|
local serviceBag = ServiceBag.new()
|
|
@@ -44,32 +48,36 @@ local function setup()
|
|
|
44
48
|
local hasSaveSlots = assert(binder:Bind(fakePlayer), "Failed to bind HasSaveSlots")
|
|
45
49
|
hasSaveSlots.MaxSlotCount.Value = 5
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-- this spec and fires inside a later package's window.
|
|
51
|
+
-- A PlayerMock never fires the real Players.PlayerRemoving, and the store the spec loaded is only
|
|
52
|
+
-- destroyed by a removal, so shut it down the way Roblox does or its auto-save loop outlives this spec.
|
|
53
|
+
maid:GiveTask(function()
|
|
51
54
|
DataStoreTestUtils.awaitServiceShutdown(playerDataStoreService)
|
|
52
55
|
fakePlayer:Destroy()
|
|
53
56
|
serviceBag:Destroy()
|
|
57
|
+
end)
|
|
58
|
+
|
|
59
|
+
local function Destroy(_self)
|
|
60
|
+
maid:DoCleaning()
|
|
54
61
|
end
|
|
55
62
|
|
|
56
|
-
|
|
63
|
+
local controller = {
|
|
57
64
|
serviceBag = serviceBag,
|
|
58
65
|
binder = binder,
|
|
59
66
|
fakePlayer = fakePlayer,
|
|
60
67
|
hasSaveSlots = hasSaveSlots,
|
|
61
68
|
mock = mock,
|
|
62
|
-
|
|
69
|
+
Destroy = Destroy,
|
|
63
70
|
}
|
|
71
|
+
|
|
72
|
+
maid:GiveTask(JestUtils.afterThis(controller))
|
|
73
|
+
|
|
74
|
+
return controller
|
|
64
75
|
end
|
|
65
76
|
|
|
66
|
-
-- Runs the body against a fresh bound player and ALWAYS tears the world down afterwards, even when
|
|
67
|
-
-- the body throws (a leaked ServiceBag's background work fails a later suite). Rethrows so the test
|
|
68
|
-
-- still reports the original failure.
|
|
69
77
|
local function runWithContext(body)
|
|
70
78
|
local context = setup()
|
|
71
79
|
local ok, err = pcall(body, context)
|
|
72
|
-
context
|
|
80
|
+
context:Destroy()
|
|
73
81
|
if not ok then
|
|
74
82
|
error(err, 0)
|
|
75
83
|
end
|
|
@@ -10,6 +10,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
10
10
|
local DataStoreMock = require("DataStoreMock")
|
|
11
11
|
local DataStoreTestUtils = require("DataStoreTestUtils")
|
|
12
12
|
local Jest = require("Jest")
|
|
13
|
+
local JestUtils = require("JestUtils")
|
|
14
|
+
local Maid = require("Maid")
|
|
13
15
|
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
14
16
|
local PlayerMock = require("PlayerMock")
|
|
15
17
|
local Promise = require("Promise")
|
|
@@ -18,26 +20,17 @@ local ServiceBag = require("ServiceBag")
|
|
|
18
20
|
|
|
19
21
|
local Workspace = game:GetService("Workspace")
|
|
20
22
|
|
|
21
|
-
local afterEach = Jest.Globals.afterEach
|
|
22
23
|
local describe = Jest.Globals.describe
|
|
23
24
|
local expect = Jest.Globals.expect
|
|
24
25
|
local it = Jest.Globals.it
|
|
25
26
|
|
|
26
27
|
local FAKE_USER_ID = 424243
|
|
27
28
|
|
|
28
|
-
local activeContext: any = nil
|
|
29
|
-
|
|
30
|
-
afterEach(function()
|
|
31
|
-
if activeContext then
|
|
32
|
-
local context = activeContext
|
|
33
|
-
activeContext = nil
|
|
34
|
-
context.destroy()
|
|
35
|
-
end
|
|
36
|
-
end)
|
|
37
|
-
|
|
38
29
|
type Ask = { slotId: string, previousSlotId: string? }
|
|
39
30
|
|
|
40
31
|
local function setup()
|
|
32
|
+
local maid = Maid.new()
|
|
33
|
+
|
|
41
34
|
local serviceBag = ServiceBag.new()
|
|
42
35
|
serviceBag:GetService(require("TeleportDataService"))
|
|
43
36
|
serviceBag:GetService(require("SaveSlotSharedDataStoreService"))
|
|
@@ -64,22 +57,16 @@ local function setup()
|
|
|
64
57
|
return verdict or Promise.resolved(true)
|
|
65
58
|
end
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
end
|
|
72
|
-
destroyed = true
|
|
73
|
-
if activeContext and activeContext.destroy == destroy then
|
|
74
|
-
activeContext = nil
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
-- The store the spec loaded is only destroyed by a removal, and a PlayerMock never fires the
|
|
78
|
-
-- real Players.PlayerRemoving, so shut down the way Roblox does or its auto-save loop outlives
|
|
79
|
-
-- this spec and fires inside a later package's window.
|
|
60
|
+
-- A PlayerMock never fires the real Players.PlayerRemoving, and the store the spec loaded is only
|
|
61
|
+
-- destroyed by a removal, so shut it down the way Roblox does or its auto-save loop outlives this spec.
|
|
62
|
+
maid:GiveTask(function()
|
|
80
63
|
DataStoreTestUtils.awaitServiceShutdown(playerDataStoreService)
|
|
81
64
|
fakePlayer:Destroy()
|
|
82
65
|
serviceBag:Destroy()
|
|
66
|
+
end)
|
|
67
|
+
|
|
68
|
+
local function Destroy(_self)
|
|
69
|
+
maid:DoCleaning()
|
|
83
70
|
end
|
|
84
71
|
|
|
85
72
|
local context = {
|
|
@@ -90,9 +77,10 @@ local function setup()
|
|
|
90
77
|
answerWith = function(promise: any)
|
|
91
78
|
verdict = promise
|
|
92
79
|
end,
|
|
93
|
-
|
|
80
|
+
Destroy = Destroy,
|
|
94
81
|
}
|
|
95
|
-
|
|
82
|
+
|
|
83
|
+
maid:GiveTask(JestUtils.afterThis(context))
|
|
96
84
|
|
|
97
85
|
return context
|
|
98
86
|
end
|
|
@@ -116,7 +104,7 @@ describe("HasSaveSlots pre-select", function()
|
|
|
116
104
|
expect(context.asks[1].previousSlotId).toBeNil()
|
|
117
105
|
expect(context.hasSaveSlots.ActiveSlotId.Value).toEqual(slotId)
|
|
118
106
|
|
|
119
|
-
context
|
|
107
|
+
context:Destroy()
|
|
120
108
|
end)
|
|
121
109
|
|
|
122
110
|
it("reports the selection being replaced when switching slots", function()
|
|
@@ -131,7 +119,7 @@ describe("HasSaveSlots pre-select", function()
|
|
|
131
119
|
expect(context.asks[2].slotId).toEqual(secondId)
|
|
132
120
|
expect(context.asks[2].previousSlotId).toEqual(firstId)
|
|
133
121
|
|
|
134
|
-
context
|
|
122
|
+
context:Destroy()
|
|
135
123
|
end)
|
|
136
124
|
|
|
137
125
|
it("asks for a new slot and for an ephemeral slot alike", function()
|
|
@@ -144,7 +132,7 @@ describe("HasSaveSlots pre-select", function()
|
|
|
144
132
|
expect(context.asks[1].slotId).toEqual(newId)
|
|
145
133
|
expect(context.asks[2].slotId).toEqual(ephemeralId)
|
|
146
134
|
|
|
147
|
-
context
|
|
135
|
+
context:Destroy()
|
|
148
136
|
end)
|
|
149
137
|
|
|
150
138
|
it("does not ask when the slot is already active", function()
|
|
@@ -156,7 +144,7 @@ describe("HasSaveSlots pre-select", function()
|
|
|
156
144
|
|
|
157
145
|
expect(#context.asks).toEqual(1)
|
|
158
146
|
|
|
159
|
-
context
|
|
147
|
+
context:Destroy()
|
|
160
148
|
end)
|
|
161
149
|
|
|
162
150
|
it("holds the selection until the answer settles", function()
|
|
@@ -176,7 +164,7 @@ describe("HasSaveSlots pre-select", function()
|
|
|
176
164
|
await(selection)
|
|
177
165
|
expect(context.hasSaveSlots.ActiveSlotId.Value).toEqual(slotId)
|
|
178
166
|
|
|
179
|
-
context
|
|
167
|
+
context:Destroy()
|
|
180
168
|
end)
|
|
181
169
|
|
|
182
170
|
it("rejects the selection and leaves the active slot alone when refused", function()
|
|
@@ -191,7 +179,7 @@ describe("HasSaveSlots pre-select", function()
|
|
|
191
179
|
expect(selection:IsRejected()).toEqual(true)
|
|
192
180
|
expect(context.hasSaveSlots.ActiveSlotId.Value).toBeNil()
|
|
193
181
|
|
|
194
|
-
context
|
|
182
|
+
context:Destroy()
|
|
195
183
|
end)
|
|
196
184
|
|
|
197
185
|
it("leaves the previous selection standing when a switch is refused", function()
|
|
@@ -208,6 +196,6 @@ describe("HasSaveSlots pre-select", function()
|
|
|
208
196
|
expect(selection:IsRejected()).toEqual(true)
|
|
209
197
|
expect(context.hasSaveSlots.ActiveSlotId.Value).toEqual(firstId)
|
|
210
198
|
|
|
211
|
-
context
|
|
199
|
+
context:Destroy()
|
|
212
200
|
end)
|
|
213
201
|
end)
|
|
@@ -10,6 +10,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
10
10
|
local DataStoreMock = require("DataStoreMock")
|
|
11
11
|
local DataStoreTestUtils = require("DataStoreTestUtils")
|
|
12
12
|
local Jest = require("Jest")
|
|
13
|
+
local JestUtils = require("JestUtils")
|
|
14
|
+
local Maid = require("Maid")
|
|
13
15
|
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
14
16
|
local PlayerMock = require("PlayerMock")
|
|
15
17
|
local PromiseTestUtils = require("PromiseTestUtils")
|
|
@@ -27,6 +29,8 @@ local it = Jest.Globals.it
|
|
|
27
29
|
local FAKE_USER_ID = 424242
|
|
28
30
|
|
|
29
31
|
local function setup()
|
|
32
|
+
local maid = Maid.new()
|
|
33
|
+
|
|
30
34
|
local playerMock = DataStoreMock.new()
|
|
31
35
|
local sharedMock = DataStoreMock.new()
|
|
32
36
|
|
|
@@ -48,28 +52,35 @@ local function setup()
|
|
|
48
52
|
local hasSaveSlots = assert(binder:Bind(fakePlayer), "Failed to bind HasSaveSlots")
|
|
49
53
|
hasSaveSlots.MaxSlotCount.Value = 5
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-- this spec and fires inside a later package's window.
|
|
55
|
+
-- A PlayerMock never fires the real Players.PlayerRemoving, and the store the spec loaded is only
|
|
56
|
+
-- destroyed by a removal, so shut it down the way Roblox does or its auto-save loop outlives this spec.
|
|
57
|
+
maid:GiveTask(function()
|
|
55
58
|
DataStoreTestUtils.awaitServiceShutdown(playerDataStoreService)
|
|
56
59
|
fakePlayer:Destroy()
|
|
57
60
|
serviceBag:Destroy()
|
|
61
|
+
end)
|
|
62
|
+
|
|
63
|
+
local function Destroy(_self)
|
|
64
|
+
maid:DoCleaning()
|
|
58
65
|
end
|
|
59
66
|
|
|
60
|
-
|
|
67
|
+
local controller = {
|
|
61
68
|
serviceBag = serviceBag,
|
|
62
69
|
hasSaveSlots = hasSaveSlots,
|
|
63
70
|
sharedService = sharedService,
|
|
64
71
|
sharedMock = sharedMock,
|
|
65
|
-
|
|
72
|
+
Destroy = Destroy,
|
|
66
73
|
}
|
|
74
|
+
|
|
75
|
+
maid:GiveTask(JestUtils.afterThis(controller))
|
|
76
|
+
|
|
77
|
+
return controller
|
|
67
78
|
end
|
|
68
79
|
|
|
69
80
|
local function runWithContext(body)
|
|
70
81
|
local context = setup()
|
|
71
82
|
local ok, err = pcall(body, context)
|
|
72
|
-
context
|
|
83
|
+
context:Destroy()
|
|
73
84
|
if not ok then
|
|
74
85
|
error(err, 0)
|
|
75
86
|
end
|
|
@@ -11,6 +11,8 @@ local require = require(script.Parent.loader).load(script)
|
|
|
11
11
|
local DataStoreMock = require("DataStoreMock")
|
|
12
12
|
local DataStoreTestUtils = require("DataStoreTestUtils")
|
|
13
13
|
local Jest = require("Jest")
|
|
14
|
+
local JestUtils = require("JestUtils")
|
|
15
|
+
local Maid = require("Maid")
|
|
14
16
|
local PlayerDataStoreService = require("PlayerDataStoreService")
|
|
15
17
|
local PlayerMock = require("PlayerMock")
|
|
16
18
|
local PromiseTestUtils = require("PromiseTestUtils")
|
|
@@ -29,6 +31,8 @@ local EPHEMERAL_KEY = SaveSlotConstants.TELEPORT_DATA_EPHEMERAL_KEY
|
|
|
29
31
|
local FAKE_USER_ID = 424242
|
|
30
32
|
|
|
31
33
|
local function setup()
|
|
34
|
+
local maid = Maid.new()
|
|
35
|
+
|
|
32
36
|
local playerMock = DataStoreMock.new()
|
|
33
37
|
local sharedMock = DataStoreMock.new()
|
|
34
38
|
|
|
@@ -50,29 +54,36 @@ local function setup()
|
|
|
50
54
|
local hasSaveSlots = assert(binder:Bind(fakePlayer), "Failed to bind HasSaveSlots")
|
|
51
55
|
hasSaveSlots.MaxSlotCount.Value = 5
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-- this spec and fires inside a later package's window.
|
|
57
|
+
-- A PlayerMock never fires the real Players.PlayerRemoving, and the store the spec loaded is only
|
|
58
|
+
-- destroyed by a removal, so shut it down the way Roblox does or its auto-save loop outlives this spec.
|
|
59
|
+
maid:GiveTask(function()
|
|
57
60
|
DataStoreTestUtils.awaitServiceShutdown(playerDataStoreService)
|
|
58
61
|
fakePlayer:Destroy()
|
|
59
62
|
serviceBag:Destroy()
|
|
63
|
+
end)
|
|
64
|
+
|
|
65
|
+
local function Destroy(_self)
|
|
66
|
+
maid:DoCleaning()
|
|
60
67
|
end
|
|
61
68
|
|
|
62
|
-
|
|
69
|
+
local controller = {
|
|
63
70
|
hasSaveSlots = hasSaveSlots,
|
|
64
71
|
sharedService = sharedService,
|
|
65
72
|
sharedMock = sharedMock,
|
|
66
73
|
teleportDataService = teleportDataService,
|
|
67
74
|
fakePlayer = fakePlayer,
|
|
68
|
-
|
|
75
|
+
Destroy = Destroy,
|
|
69
76
|
}
|
|
77
|
+
|
|
78
|
+
maid:GiveTask(JestUtils.afterThis(controller))
|
|
79
|
+
|
|
80
|
+
return controller
|
|
70
81
|
end
|
|
71
82
|
|
|
72
83
|
local function runWithContext(body)
|
|
73
84
|
local context = setup()
|
|
74
85
|
local ok, err = pcall(body, context)
|
|
75
|
-
context
|
|
86
|
+
context:Destroy()
|
|
76
87
|
if not ok then
|
|
77
88
|
error(err, 0)
|
|
78
89
|
end
|