Files
moonsource-fanqie/tests/fanqie/setting_spec.lua
T
GarfieldandCopilot 9190db9019 ✨ 初始提交:月读第三方书源插件集合
每个书源一个独立插件目录,含微信读书公众号订阅、书架导入等完整功能。

Co-authored-by: Copilot <[email protected]>
2026-11-16 12:08:03 +08:00

31 lines
1.0 KiB
Lua

--[[--
番茄设置页:扫码入口与段评开关,不含 Cookie / 浏览器登录。
@module tests.moonsource_fanqie.setting_spec
--]]
---@diagnostic disable: undefined-field, missing-fields, param-type-mismatch
local Assert = require("support.assert")
package.loaded["ui.themes.widgets.row"] = { widget = function(spec) return spec end }
local cfg = {}
package.loaded["utils.settings"] = {
getSource = function() return cfg end,
saveSource = function(_id, value) if value then cfg = value end end,
}
package.loaded["source.category_setting"] = {
row = function() return function(iw) return { title = "分类", width = iw } end end,
}
package.loaded["moonsource_fanqie.setting"] = nil
local Setting = require("moonsource_fanqie.setting")
Assert.is_nil(Setting.browser)
local rows = Setting.rows()
Assert.eq(rows[1](400).title, "番茄账号与登录")
Assert.eq(rows[2](400).title, "显示段评")
for _idx, factory in ipairs(rows) do
local row = factory(400)
Assert.is_true(row.title ~= "浏览器登录" and row.title ~= "粘贴 Cookie")
end