@quenty/saveslot 2.9.1 → 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.
@@ -0,0 +1,112 @@
1
+ --!strict
2
+ --[[
3
+ Characterizes how the save-slot system handles the overflow-save failure: when a slot accumulates
4
+ more data than Roblox can serialize under its per-key size ceiling, the save must fail loudly
5
+ instead of silently dropping data or corrupting the slot that was already stored. Driven through the
6
+ same mock-injected PlayerDataStoreService and SaveSlotConstants substore layout the load flow uses
7
+ (see SaveSlotService.LoadFlow.spec), with the DataStoreMock configured to a small
8
+ [DataStoreMock.SetMaxValueLength] so the overflow triggers without a multi-megabyte payload.
9
+
10
+ @class SaveSlotService.Overflow.spec.lua
11
+ ]]
12
+ local require = require(script.Parent.loader).load(script)
13
+
14
+ local DataStore = require("DataStore")
15
+ local DataStoreMock = require("DataStoreMock")
16
+ local DataStoreTestUtils = require("DataStoreTestUtils")
17
+ local Jest = require("Jest")
18
+ local JestUtils = require("JestUtils")
19
+ local Maid = require("Maid")
20
+ local PlayerDataStoreService = require("PlayerDataStoreService")
21
+ local PromiseTestUtils = require("PromiseTestUtils")
22
+ local SaveSlotConstants = require("SaveSlotConstants")
23
+ local ServiceBag = require("ServiceBag")
24
+
25
+ local describe = Jest.Globals.describe
26
+ local expect = Jest.Globals.expect
27
+ local it = Jest.Globals.it
28
+
29
+ local USER_ID = 1
30
+ local MAX_VALUE_LENGTH = 8192
31
+ local OVERSIZED_LENGTH = 32768
32
+
33
+ local function setup()
34
+ local maid = Maid.new()
35
+ local mock = DataStoreMock.new()
36
+
37
+ local serviceBag = maid:Add(ServiceBag.new())
38
+ local playerDataStoreService: PlayerDataStoreService.PlayerDataStoreService =
39
+ serviceBag:GetService(PlayerDataStoreService) :: any
40
+ serviceBag:Init()
41
+ playerDataStoreService:SetRobloxDataStore(mock)
42
+ serviceBag:Start()
43
+
44
+ local status, resolved = PromiseTestUtils.awaitOutcome(playerDataStoreService:PromiseDataStore(USER_ID), 10)
45
+ assert(status == "resolved", `Failed to resolve the player data store ({status})`)
46
+
47
+ local dataStore: DataStore.DataStore = resolved
48
+ local slotStore = dataStore
49
+ :GetSubStore(SaveSlotConstants.SYSTEM_STORE_KEY)
50
+ :GetSubStore(SaveSlotConstants.SLOT_STORE_KEY)
51
+ :GetSubStore("slot-abc")
52
+
53
+ local function Destroy(_self)
54
+ -- Lift the limit before teardown so the session lock's final unlock-save can flush and release
55
+ -- cleanly, rather than throwing during cleanup and leaking a retry into a later spec (these all
56
+ -- share one test place).
57
+ mock:SetMaxValueLength(nil)
58
+ -- The store the spec loaded is only destroyed by a removal, and a PlayerMock never fires the
59
+ -- real Players.PlayerRemoving, so shut down the way Roblox does or its auto-save loop outlives
60
+ -- this spec and fires inside a later package's window.
61
+ DataStoreTestUtils.awaitServiceShutdown(playerDataStoreService)
62
+ maid:DoCleaning()
63
+ end
64
+
65
+ local controller = {
66
+ mock = mock,
67
+ dataStore = dataStore,
68
+ slotStore = slotStore,
69
+ -- Stores a slot value and saves it, so the spec starts from data that is already in the store.
70
+ saveSlotValue = function(key: string, value: any): string
71
+ slotStore:Store(key, value)
72
+ return (PromiseTestUtils.awaitOutcome(dataStore:Save(), 10))
73
+ end,
74
+ -- Grows the slot past the (lowered) per-key ceiling and saves.
75
+ saveOversizedSlot = function(): string
76
+ mock:SetMaxValueLength(MAX_VALUE_LENGTH)
77
+ slotStore:Store("blob", string.rep("A", OVERSIZED_LENGTH))
78
+ return (PromiseTestUtils.awaitOutcome(dataStore:Save(), 10))
79
+ end,
80
+ Destroy = Destroy,
81
+ }
82
+
83
+ maid:GiveTask(JestUtils.afterThis(controller))
84
+
85
+ return controller
86
+ end
87
+
88
+ describe("save slot overflow save", function()
89
+ it("fails the save when a slot grows past the datastore size limit", function()
90
+ local controller = setup()
91
+
92
+ expect(controller.saveSlotValue("coins", 25)).toEqual("resolved")
93
+ expect(controller.saveOversizedSlot()).toEqual("rejected")
94
+
95
+ controller:Destroy()
96
+ end)
97
+
98
+ it("preserves the already-saved slot data when an oversized save fails", function()
99
+ local controller = setup()
100
+
101
+ expect(controller.saveSlotValue("coins", 25)).toEqual("resolved")
102
+ expect(controller.saveOversizedSlot()).toEqual("rejected")
103
+
104
+ controller.mock:SetMaxValueLength(nil)
105
+
106
+ local loadStatus, coins = PromiseTestUtils.awaitOutcome(controller.slotStore:Load("coins"), 10)
107
+ expect(loadStatus).toEqual("resolved")
108
+ expect(coins).toEqual(25)
109
+
110
+ controller:Destroy()
111
+ end)
112
+ end)
@@ -1,10 +1,10 @@
1
- --!nonstrict
1
+ --!strict
2
2
  --[[
3
3
  Playtime accrual persists on the save that asked for it. The flush runs from a saving callback,
4
4
  so a value that only reached the store through the deferred attribute listener would land one
5
5
  save late -- and the final save-on-leave would drop the tail of the session entirely.
6
6
 
7
- @class SaveSlotPlaytime.spec.lua
7
+ @class SaveSlotService.Playtime.spec.lua
8
8
  ]]
9
9
  local require = require(script.Parent.loader).load(script)
10
10
 
@@ -12,6 +12,7 @@ local DataStoreMock = require("DataStoreMock")
12
12
  local DataStoreTestUtils = require("DataStoreTestUtils")
13
13
  local HasSaveSlotsDataStore = require("HasSaveSlotsDataStore")
14
14
  local Jest = require("Jest")
15
+ local JestUtils = require("JestUtils")
15
16
  local Maid = require("Maid")
16
17
  local PlayerDataStoreService = require("PlayerDataStoreService")
17
18
  local Promise = require("Promise")
@@ -31,8 +32,10 @@ local SESSION_SECONDS = 120
31
32
  local function setup()
32
33
  local maid = Maid.new()
33
34
  local serviceBag = maid:Add(ServiceBag.new())
34
- local playerDataStoreService = serviceBag:GetService(PlayerDataStoreService)
35
- local sharedDataStoreService = serviceBag:GetService(SaveSlotSharedDataStoreService)
35
+ local playerDataStoreService: PlayerDataStoreService.PlayerDataStoreService =
36
+ serviceBag:GetService(PlayerDataStoreService) :: any
37
+ local sharedDataStoreService: SaveSlotSharedDataStoreService.SaveSlotSharedDataStoreService =
38
+ serviceBag:GetService(SaveSlotSharedDataStoreService) :: any
36
39
  serviceBag:Init()
37
40
 
38
41
  local mock = DataStoreMock.new()
@@ -64,7 +67,7 @@ local function setup()
64
67
  }))
65
68
  await(slotsDataStore:PromiseSlotsLoaded(), "slots loaded")
66
69
 
67
- return {
70
+ local controller = {
68
71
  await = await,
69
72
  mock = mock,
70
73
  dataStore = dataStore,
@@ -74,8 +77,12 @@ local function setup()
74
77
  beginBackdatedSession = function(): string
75
78
  local slotId = await(slotsDataStore:PromiseCreateSlot(1), "create")
76
79
  await(slotsDataStore:PromiseSelectSlot(slotId), "select")
77
- slotsDataStore._playSessionStart -= SESSION_SECONDS
78
- slotsDataStore._playSessionLastFlush -= SESSION_SECONDS
80
+ slotsDataStore._playSessionStart = assert(slotsDataStore._playSessionStart, "No _playSessionStart")
81
+ - SESSION_SECONDS
82
+ slotsDataStore._playSessionLastFlush = assert(
83
+ slotsDataStore._playSessionLastFlush,
84
+ "No _playSessionLastFlush"
85
+ ) - SESSION_SECONDS
79
86
  return slotId
80
87
  end,
81
88
  storedMetadata = function(slotId: string): any
@@ -84,11 +91,15 @@ local function setup()
84
91
  local metadata = system and system[SaveSlotConstants.METADATA_STORE_KEY]
85
92
  return metadata and metadata[slotId]
86
93
  end,
87
- destroy = function()
94
+ Destroy = function(_self)
88
95
  DataStoreTestUtils.awaitServiceShutdown(playerDataStoreService)
89
96
  maid:DoCleaning()
90
97
  end,
91
98
  }
99
+
100
+ maid:GiveTask(JestUtils.afterThis(controller))
101
+
102
+ return controller
92
103
  end
93
104
 
94
105
  describe("save slot playtime", function()
@@ -104,7 +115,7 @@ describe("save slot playtime", function()
104
115
  expect(stored.TimePlayed).toBeGreaterThanOrEqual(SESSION_SECONDS)
105
116
  expect(stored.LastSessionLength).toBeGreaterThanOrEqual(SESSION_SECONDS)
106
117
 
107
- controller.destroy()
118
+ controller:Destroy()
108
119
  end)
109
120
 
110
121
  it("keeps the replicated attribute and the stored value in step", function()
@@ -113,10 +124,9 @@ describe("save slot playtime", function()
113
124
 
114
125
  controller.await(controller.dataStore:Save(), "save")
115
126
 
116
- expect(controller.slotsDataStore:GetSlotMetadata(slotId).TimePlayed).toEqual(
117
- controller.storedMetadata(slotId).TimePlayed
118
- )
127
+ local metadata = assert(controller.slotsDataStore:GetSlotMetadata(slotId), "No slot metadata")
128
+ expect(metadata.TimePlayed).toEqual(controller.storedMetadata(slotId).TimePlayed)
119
129
 
120
- controller.destroy()
130
+ controller:Destroy()
121
131
  end)
122
132
  end)
@@ -3,7 +3,7 @@
3
3
  Coverage for SaveSlotService's ServiceBag-driven configuration surface — the parts reachable
4
4
  without a bound Player (a headless cloud test server has none). The player-driven slot
5
5
  selection flow (which needs a real Player on the HasSaveSlots binder) is characterized
6
- separately at the datastore layer in SaveSlotLoadFlow.spec.
6
+ separately at the datastore layer in SaveSlotService.LoadFlow.spec.
7
7
 
8
8
  @class SaveSlotService.spec.lua
9
9
  ]]
@@ -12,6 +12,7 @@ local require = require(script.Parent.loader).load(script)
12
12
  local DataStoreMock = require("DataStoreMock")
13
13
  local DataStoreTestUtils = require("DataStoreTestUtils")
14
14
  local Jest = require("Jest")
15
+ local JestUtils = require("JestUtils")
15
16
  local Maid = require("Maid")
16
17
  local PlayerDataStoreService = require("PlayerDataStoreService")
17
18
  local PlayerMock = require("PlayerMock")
@@ -38,7 +39,7 @@ local function setup()
38
39
  serviceBag:Init()
39
40
  playerDataStoreService:SetRobloxDataStore(DataStoreMock.new())
40
41
 
41
- return {
42
+ local controller = {
42
43
  serviceBag = serviceBag,
43
44
  saveSlotService = saveSlotService,
44
45
  teleportDataService = teleportDataService,
@@ -51,7 +52,7 @@ local function setup()
51
52
  expect(ok).toEqual(true)
52
53
  return value
53
54
  end,
54
- destroy = function(_self)
55
+ Destroy = function(_self)
55
56
  -- The store the spec loaded is only destroyed by a removal, and a PlayerMock never fires the
56
57
  -- real Players.PlayerRemoving, so shut down the way Roblox does or its auto-save loop outlives
57
58
  -- this spec and fires inside a later package's window.
@@ -59,6 +60,10 @@ local function setup()
59
60
  maid:DoCleaning()
60
61
  end,
61
62
  }
63
+
64
+ maid:GiveTask(JestUtils.afterThis(controller))
65
+
66
+ return controller
62
67
  end
63
68
 
64
69
  describe("SaveSlotService initialization", function()
@@ -70,7 +75,7 @@ describe("SaveSlotService initialization", function()
70
75
  end).never.toThrow()
71
76
  expect(controller.saveSlotService).never.toBeNil()
72
77
 
73
- controller:destroy()
78
+ controller:Destroy()
74
79
  end)
75
80
  end)
76
81
 
@@ -80,7 +85,7 @@ describe("SaveSlotService.GetExplicitSelectionRequired", function()
80
85
 
81
86
  expect(controller.saveSlotService:GetExplicitSelectionRequired()).toEqual(false)
82
87
 
83
- controller:destroy()
88
+ controller:Destroy()
84
89
  end)
85
90
 
86
91
  it("should be true after RequireExplicitSelection", function()
@@ -89,7 +94,7 @@ describe("SaveSlotService.GetExplicitSelectionRequired", function()
89
94
  controller.saveSlotService:RequireExplicitSelection()
90
95
  expect(controller.saveSlotService:GetExplicitSelectionRequired()).toEqual(true)
91
96
 
92
- controller:destroy()
97
+ controller:Destroy()
93
98
  end)
94
99
  end)
95
100
 
@@ -101,7 +106,7 @@ describe("SaveSlotService:RegisterPreSelectCallback", function()
101
106
  controller.saveSlotService:RegisterPreSelectCallback(nil :: any)
102
107
  end).toThrow("Bad callback")
103
108
 
104
- controller:destroy()
109
+ controller:Destroy()
105
110
  end)
106
111
 
107
112
  it("accepts registrations after Start", function()
@@ -118,7 +123,7 @@ describe("SaveSlotService:RegisterPreSelectCallback", function()
118
123
  controller.awaitBool(controller.saveSlotService:PromisePreSelect(player, "slot-1"))
119
124
  expect(ran).toEqual(1)
120
125
 
121
- controller:destroy()
126
+ controller:Destroy()
122
127
  end)
123
128
 
124
129
  it("stops running a callback once removed", function()
@@ -139,7 +144,7 @@ describe("SaveSlotService:RegisterPreSelectCallback", function()
139
144
  controller.awaitBool(controller.saveSlotService:PromisePreSelect(player, "slot-1"))
140
145
  expect(ran).toEqual(1)
141
146
 
142
- controller:destroy()
147
+ controller:Destroy()
143
148
  end)
144
149
  end)
145
150
 
@@ -151,7 +156,7 @@ describe("SaveSlotService:PromisePreSelect", function()
151
156
  true
152
157
  )
153
158
 
154
- controller:destroy()
159
+ controller:Destroy()
155
160
  end)
156
161
 
157
162
  it("hands each callback the player and the selection it is replacing", function()
@@ -171,7 +176,7 @@ describe("SaveSlotService:PromisePreSelect", function()
171
176
  expect(calls[1].slotId).toEqual("slot-2")
172
177
  expect(calls[1].previousSlotId).toEqual("slot-1")
173
178
 
174
- controller:destroy()
179
+ controller:Destroy()
175
180
  end)
176
181
 
177
182
  it("refuses when a callback returns false", function()
@@ -185,7 +190,7 @@ describe("SaveSlotService:PromisePreSelect", function()
185
190
  false
186
191
  )
187
192
 
188
- controller:destroy()
193
+ controller:Destroy()
189
194
  end)
190
195
 
191
196
  it("refuses when a returned promise resolves false", function()
@@ -199,7 +204,7 @@ describe("SaveSlotService:PromisePreSelect", function()
199
204
  false
200
205
  )
201
206
 
202
- controller:destroy()
207
+ controller:Destroy()
203
208
  end)
204
209
 
205
210
  it("waits on every returned promise before answering", function()
@@ -222,7 +227,7 @@ describe("SaveSlotService:PromisePreSelect", function()
222
227
  second:Resolve()
223
228
  expect(controller.awaitBool(verdict)).toEqual(true)
224
229
 
225
- controller:destroy()
230
+ controller:Destroy()
226
231
  end)
227
232
 
228
233
  it("runs every callback even once one has refused", function()
@@ -241,7 +246,7 @@ describe("SaveSlotService:PromisePreSelect", function()
241
246
 
242
247
  expect(ranAfter).toEqual(1)
243
248
 
244
- controller:destroy()
249
+ controller:Destroy()
245
250
  end)
246
251
 
247
252
  it("allows the selection when a callback errors rather than treating it as a refusal", function()
@@ -261,7 +266,7 @@ describe("SaveSlotService:PromisePreSelect", function()
261
266
  )
262
267
  expect(ranAfter).toEqual(1)
263
268
 
264
- controller:destroy()
269
+ controller:Destroy()
265
270
  end)
266
271
 
267
272
  it("allows the selection when a returned promise rejects", function()
@@ -275,7 +280,7 @@ describe("SaveSlotService:PromisePreSelect", function()
275
280
  true
276
281
  )
277
282
 
278
- controller:destroy()
283
+ controller:Destroy()
279
284
  end)
280
285
  end)
281
286
 
@@ -288,7 +293,7 @@ describe("SaveSlotService configuration guards", function()
288
293
  controller.saveSlotService:RequireExplicitSelection()
289
294
  end).toThrow("RequireExplicitSelection must be called before Start")
290
295
 
291
- controller:destroy()
296
+ controller:Destroy()
292
297
  end)
293
298
 
294
299
  it("should reject SetMaxSlotCount after Start", function()
@@ -299,7 +304,7 @@ describe("SaveSlotService configuration guards", function()
299
304
  controller.saveSlotService:SetMaxSlotCount(3)
300
305
  end).toThrow("SetMaxSlotCount must be called before Start")
301
306
 
302
- controller:destroy()
307
+ controller:Destroy()
303
308
  end)
304
309
 
305
310
  it("should accept a valid SetMaxSlotCount before Start", function()
@@ -309,7 +314,7 @@ describe("SaveSlotService configuration guards", function()
309
314
  controller.saveSlotService:SetMaxSlotCount(3)
310
315
  end).never.toThrow()
311
316
 
312
- controller:destroy()
317
+ controller:Destroy()
313
318
  end)
314
319
 
315
320
  it("should reject a SetMaxSlotCount below 1", function()
@@ -319,7 +324,7 @@ describe("SaveSlotService configuration guards", function()
319
324
  controller.saveSlotService:SetMaxSlotCount(0)
320
325
  end).toThrow("Bad maxSlotCount")
321
326
 
322
- controller:destroy()
327
+ controller:Destroy()
323
328
  end)
324
329
 
325
330
  it("should accept SetUnlimitedSlots before Start", function()
@@ -329,7 +334,7 @@ describe("SaveSlotService configuration guards", function()
329
334
  controller.saveSlotService:SetUnlimitedSlots()
330
335
  end).never.toThrow()
331
336
 
332
- controller:destroy()
337
+ controller:Destroy()
333
338
  end)
334
339
 
335
340
  it("should reject SetUnlimitedSlots after Start", function()
@@ -340,7 +345,7 @@ describe("SaveSlotService configuration guards", function()
340
345
  controller.saveSlotService:SetUnlimitedSlots()
341
346
  end).toThrow("SetMaxSlotCount must be called before Start")
342
347
 
343
- controller:destroy()
348
+ controller:Destroy()
344
349
  end)
345
350
 
346
351
  it("should reject a non-function default summary provider", function()
@@ -350,7 +355,7 @@ describe("SaveSlotService configuration guards", function()
350
355
  controller.saveSlotService:RegisterDefaultSummaryProvider("progress", "not a function" :: any)
351
356
  end).toThrow("Bad provider")
352
357
 
353
- controller:destroy()
358
+ controller:Destroy()
354
359
  end)
355
360
 
356
361
  it("should reject a non-string default summary provider name", function()
@@ -362,7 +367,7 @@ describe("SaveSlotService configuration guards", function()
362
367
  end)
363
368
  end).toThrow("Bad name")
364
369
 
365
- controller:destroy()
370
+ controller:Destroy()
366
371
  end)
367
372
 
368
373
  it("registers a default summary provider and returns an unregister function", function()
@@ -380,7 +385,7 @@ describe("SaveSlotService configuration guards", function()
380
385
  unregister()
381
386
  end).never.toThrow()
382
387
 
383
- controller:destroy()
388
+ controller:Destroy()
384
389
  end)
385
390
  end)
386
391
 
@@ -396,7 +401,7 @@ describe("SaveSlotService internal teleport", function()
396
401
  local slice = TeleportDataEnvelopeUtils.readSlice(data, 111)
397
402
  expect(slice and slice[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY]).toEqual("slot-xyz")
398
403
 
399
- controller:destroy()
404
+ controller:Destroy()
400
405
  end)
401
406
 
402
407
  it("should not carry a slot id when the single player has no active slot", function()
@@ -409,7 +414,7 @@ describe("SaveSlotService internal teleport", function()
409
414
  local slice = TeleportDataEnvelopeUtils.readSlice(data, 111)
410
415
  expect(slice and slice[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY]).toBeNil()
411
416
 
412
- controller:destroy()
417
+ controller:Destroy()
413
418
  end)
414
419
 
415
420
  it("should carry each player's own active slot id for a multi-player teleport", function()
@@ -427,7 +432,7 @@ describe("SaveSlotService internal teleport", function()
427
432
  expect(sliceA and sliceA[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY]).toEqual("slot-a")
428
433
  expect(sliceB and sliceB[SaveSlotConstants.TELEPORT_DATA_SLOT_KEY]).toEqual("slot-b")
429
434
 
430
- controller:destroy()
435
+ controller:Destroy()
431
436
  end)
432
437
 
433
438
  it("should report a client-initiated teleport (non-trusted band) as internal", function()
@@ -441,7 +446,7 @@ describe("SaveSlotService internal teleport", function()
441
446
 
442
447
  expect(controller.awaitBool(controller.saveSlotService:PromiseIsInternalTeleport(arrived))).toEqual(true)
443
448
 
444
- controller:destroy()
449
+ controller:Destroy()
445
450
  end)
446
451
 
447
452
  it("should report a server-initiated teleport (trusted band) as internal", function()
@@ -456,7 +461,7 @@ describe("SaveSlotService internal teleport", function()
456
461
 
457
462
  expect(controller.awaitBool(controller.saveSlotService:PromiseIsInternalTeleport(arrived))).toEqual(true)
458
463
 
459
- controller:destroy()
464
+ controller:Destroy()
460
465
  end)
461
466
 
462
467
  it("should report a fresh join (no arrived data) as not internal", function()
@@ -468,6 +473,6 @@ describe("SaveSlotService internal teleport", function()
468
473
 
469
474
  expect(controller.awaitBool(controller.saveSlotService:PromiseIsInternalTeleport(fresh))).toEqual(false)
470
475
 
471
- controller:destroy()
476
+ controller:Destroy()
472
477
  end)
473
478
  end)
@@ -8,6 +8,8 @@ local require = require(script.Parent.loader).load(script)
8
8
 
9
9
  local DataStoreMock = require("DataStoreMock")
10
10
  local Jest = require("Jest")
11
+ local JestUtils = require("JestUtils")
12
+ local Maid = require("Maid")
11
13
  local PromiseTestUtils = require("PromiseTestUtils")
12
14
  local SaveSlotSharedDataStoreService = require("SaveSlotSharedDataStoreService")
13
15
  local ServiceBag = require("ServiceBag")
@@ -17,31 +19,36 @@ local expect = Jest.Globals.expect
17
19
  local it = Jest.Globals.it
18
20
 
19
21
  local function setup()
22
+ local maid = Maid.new()
23
+
20
24
  local mock = DataStoreMock.new()
21
25
 
22
- local serviceBag = ServiceBag.new()
26
+ local serviceBag = maid:Add(ServiceBag.new())
23
27
  local service: SaveSlotSharedDataStoreService.SaveSlotSharedDataStoreService =
24
28
  serviceBag:GetService(SaveSlotSharedDataStoreService) :: any
25
29
  serviceBag:Init()
26
30
  service:SetRobloxDataStore(mock)
27
31
  serviceBag:Start()
28
32
 
29
- local function destroy()
30
- serviceBag:Destroy()
33
+ local function Destroy(_self)
34
+ maid:DoCleaning()
31
35
  end
32
36
 
33
- return {
37
+ local controller = {
34
38
  service = service,
35
39
  mock = mock,
36
- destroy = destroy,
40
+ Destroy = Destroy,
37
41
  }
42
+
43
+ maid:GiveTask(JestUtils.afterThis(controller))
44
+
45
+ return controller
38
46
  end
39
47
 
40
- -- Always tears the world down, even when the body throws (a leaked ServiceBag fails a later suite).
41
48
  local function runWithContext(body)
42
49
  local context = setup()
43
50
  local ok, err = pcall(body, context)
44
- context.destroy()
51
+ context:Destroy()
45
52
  if not ok then
46
53
  error(err, 0)
47
54
  end
@@ -1,4 +1,4 @@
1
- --!nonstrict
1
+ --!strict
2
2
  --[[
3
3
  @class SaveSlotData.spec.lua
4
4
  ]]