Skip to content

Commit 7bbf782

Browse files
hjpalphaRathoz
authored andcommitted
feat: add a simple torage test
1 parent 77b9178 commit 7bbf782

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

‎lua/spec/participant_table_spec.lua‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,5 +387,77 @@ describe('Participant Table', function()
387387
MockLpdb.tearDown()
388388
end)
389389
end)
390+
it('storage', function()
391+
local LpdbPlacementStub = stub(mw.ext.LiquipediaDB, 'lpdb_placement')
392+
local LpdbQueryStub = stub(mw.ext.LiquipediaDB, 'lpdb', {})
393+
TeamTemplateMock.setUp()
394+
395+
ParticipantTable.run(argsPlain)
396+
397+
local lpdbExpected = {
398+
{
399+
objectName = 'ranking0_Clem',
400+
extradata = '[]',
401+
icon = 'test.png',
402+
icondark = 'test dark.png',
403+
liquipediatier = '1',
404+
liquipediatiertype = 'Qualifier',
405+
mode = '1v1',
406+
opponentname = 'Clem',
407+
opponentplayers = '{"p1":"Clem","p1dn":"Clem","p1faction":"t","p1flag":"France"}',
408+
opponenttype = 'solo',
409+
parent = 'FakePage',
410+
prizepoolindex = 0,
411+
series = 'Test Series',
412+
tournament = 'Test Tournament',
413+
type = 'Offline',
414+
},
415+
{
416+
objectName = 'ranking0_Lambo',
417+
extradata = '[]',
418+
icon = 'test.png',
419+
icondark = 'test dark.png',
420+
liquipediatier = '1',
421+
liquipediatiertype = 'Qualifier',
422+
mode = '1v1',
423+
opponentname = 'Lambo',
424+
opponentplayers = '{"p1":"Lambo","p1dn":"Lambo","p1faction":"z","p1flag":"Germany"}',
425+
opponenttype = 'solo',
426+
parent = 'FakePage',
427+
prizepoolindex = 0,
428+
series = 'Test Series',
429+
tournament = 'Test Tournament',
430+
type = 'Offline',
431+
},
432+
{
433+
objectName = 'ranking0_ShoWTimE',
434+
extradata = '[]',
435+
icon = 'test.png',
436+
icondark = 'test dark.png',
437+
liquipediatier = '1',
438+
liquipediatiertype = 'Qualifier',
439+
mode = '1v1',
440+
opponentname = 'ShoWTimE',
441+
opponentplayers = '{"p1":"ShoWTimE","p1dn":"ShoWTimE","p1faction":"p","p1flag":"Germany"}',
442+
opponenttype = 'solo',
443+
parent = 'FakePage',
444+
prizepoolindex = 0,
445+
series = 'Test Series',
446+
tournament = 'Test Tournament',
447+
type = 'Offline',
448+
},
449+
}
450+
451+
for _, row in ipairs(lpdbExpected) do
452+
local localRow = Table.deepCopy(row)
453+
local objectName = localRow.objectName
454+
localRow.objectName = nil
455+
assert.stub(LpdbPlacementStub).was.called_with(objectName, localRow)
456+
end
457+
458+
LpdbPlacementStub:revert()
459+
LpdbQueryStub:revert()
460+
TeamTemplateMock.setUp()
461+
end)
390462
SetActiveWiki()
391463
end)

0 commit comments

Comments
 (0)