2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00
koreader/spec/unit/quickstart_spec.lua
Qingping Hou 72ae80870c quickstart fix (#2804)
* translation text fix

* quickstart(fix): go back to home dir after document close

* quickstart(fix): purge old quick start files

* spec: fix quickstart tests
2017-04-24 08:27:29 +02:00

37 lines
1.7 KiB
Lua

describe("QuickStart module", function()
setup(function()
require("commonrequire")
end)
it("should return false shown_version lower than force_show_version", function()
G_reader_settings:saveSetting("quickstart_shown_version", 1)
G_reader_settings:flush()
local QuickStart = require("ui/quickstart")
QuickStart.quickstart_force_show_version = 2
assert.is_false(QuickStart:isShown())
end)
it("should return true when shown_version equal to force_show_version", function()
G_reader_settings:saveSetting("quickstart_shown_version", 1)
G_reader_settings:flush()
local QuickStart = require("ui/quickstart")
QuickStart.quickstart_force_show_version = 1
assert.is_true(QuickStart:isShown())
end)
it("should return true when shown_version higher than force_show_version", function()
G_reader_settings:saveSetting("quickstart_shown_version", 2)
G_reader_settings:flush()
local QuickStart = require("ui/quickstart")
QuickStart.quickstart_force_show_version = 1
assert.is_true(QuickStart:isShown())
end)
it("should return a proper quickstart filename", function()
local DataStorage = require("datastorage")
local QuickStart = require("ui/quickstart")
local Version = require("version")
local language = "en"
local rev = Version:getCurrentRevision()
local quickstart_dir = string.format("%s%s", DataStorage:getDataDir(), "/help")
local expected_quickstart_filename = ("%s/quickstart-%s-%s.html"):format(quickstart_dir, language, rev)
assert.is.same(expected_quickstart_filename, QuickStart:getQuickStart())
end)
end)