Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lua/spec/prize_pool_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@ describe('prize pool', function()
local Table = require('Module:Table')
local Variables = require('Module:Variables')
local tournamentData = require('test_assets.tournaments').dummy
local TeamTemplateMock = require('wikis.commons.Mock.TeamTemplate')

local LpdbPlacementStub

before_each(function()
-- Team templates are mocked for every test: TeamTemplate.getRawOrNil is
-- memoized at module scope, so a team resolved without the mock caches a
-- nil result that leaks into later tests that do expect the mock.
TeamTemplateMock.setUp()
stub(mw.ext.LiquipediaDB, "lpdb", {})
stub(mw.ext.LiquipediaDB, "lpdb_tournament")
LpdbPlacementStub = stub(mw.ext.LiquipediaDB, "lpdb_placement")
InfoboxLeague.run(tournamentData)
end)

after_each(function ()
TeamTemplateMock.tearDown()
LpdbPlacementStub:revert()
---@diagnostic disable-next-line: undefined-field
mw.ext.LiquipediaDB.lpdb:revert()
Expand Down Expand Up @@ -280,10 +286,7 @@ describe('prize pool', function()

it('stores the USD player share in placement extradata', function()
local Json = require('Module:Json')
local TeamTemplateMock = require('wikis.commons.Mock.TeamTemplate')
TeamTemplateMock.setUp()
PrizePool(clubShareUsdPoolArgs):create():build()
TeamTemplateMock.tearDown()

local playerShares = {}
for _, call in ipairs(LpdbPlacementStub.calls) do
Expand Down
Binary file modified lua/spec/snapshots/prize_pool_club_share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.