fix(test): mock
This commit is contained in:
parent
76cb1e456e
commit
a84b1697bf
4 changed files with 52 additions and 3 deletions
|
|
@ -12,6 +12,29 @@ describe('cp command parsing', function()
|
|||
}
|
||||
package.loaded['cp.log'] = mock_logger
|
||||
|
||||
local mock_async_setup = {
|
||||
setup_contest_async = function() end,
|
||||
handle_full_setup_async = function() end,
|
||||
setup_problem_async = function() end,
|
||||
}
|
||||
package.loaded['cp.async.setup'] = mock_async_setup
|
||||
local mock_setup = {
|
||||
set_platform = function()
|
||||
return true
|
||||
end,
|
||||
}
|
||||
package.loaded['cp.setup'] = mock_setup
|
||||
|
||||
local mock_state = {
|
||||
get_platform = function()
|
||||
return 'atcoder'
|
||||
end,
|
||||
get_contest_id = function()
|
||||
return 'abc123'
|
||||
end,
|
||||
}
|
||||
package.loaded['cp.state'] = mock_state
|
||||
|
||||
cp = require('cp')
|
||||
cp.setup({
|
||||
contests = {
|
||||
|
|
@ -29,6 +52,9 @@ describe('cp command parsing', function()
|
|||
|
||||
after_each(function()
|
||||
package.loaded['cp.log'] = nil
|
||||
package.loaded['cp.async.setup'] = nil
|
||||
package.loaded['cp.setup'] = nil
|
||||
package.loaded['cp.state'] = nil
|
||||
end)
|
||||
|
||||
describe('empty arguments', function()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue