Test if Readerly fonts are included in zip
This commit is contained in:
@@ -12,6 +12,10 @@ function hasKoreaderAssets() {
|
|||||||
&& fs.existsSync(path.join(WEBROOT, 'koreader', 'release.json'));
|
&& fs.existsSync(path.join(WEBROOT, 'koreader', 'release.json'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasReaderlyAssets() {
|
||||||
|
return fs.existsSync(path.join(WEBROOT, 'readerly', 'KF_Readerly.zip'));
|
||||||
|
}
|
||||||
|
|
||||||
function hasFirmwareZip() {
|
function hasFirmwareZip() {
|
||||||
return fs.existsSync(FIRMWARE_PATH);
|
return fs.existsSync(FIRMWARE_PATH);
|
||||||
}
|
}
|
||||||
@@ -28,6 +32,7 @@ function cleanupFirmwareSymlink() {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
hasNickelMenuAssets,
|
hasNickelMenuAssets,
|
||||||
hasKoreaderAssets,
|
hasKoreaderAssets,
|
||||||
|
hasReaderlyAssets,
|
||||||
hasFirmwareZip,
|
hasFirmwareZip,
|
||||||
setupFirmwareSymlink,
|
setupFirmwareSymlink,
|
||||||
cleanupFirmwareSymlink,
|
cleanupFirmwareSymlink,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const zlib = require('zlib');
|
|||||||
const JSZip = require('jszip');
|
const JSZip = require('jszip');
|
||||||
|
|
||||||
const { FIRMWARE_PATH, EXPECTED_SHA1, ORIGINAL_TGZ_SHA1 } = require('./helpers/paths');
|
const { FIRMWARE_PATH, EXPECTED_SHA1, ORIGINAL_TGZ_SHA1 } = require('./helpers/paths');
|
||||||
const { hasNickelMenuAssets, hasKoreaderAssets, hasFirmwareZip, setupFirmwareSymlink, cleanupFirmwareSymlink } = require('./helpers/assets');
|
const { hasNickelMenuAssets, hasKoreaderAssets, hasReaderlyAssets, hasFirmwareZip, setupFirmwareSymlink, cleanupFirmwareSymlink } = require('./helpers/assets');
|
||||||
const { injectMockDevice, connectMockDevice, overrideFirmwareURLs, goToManualMode, readMockFile, mockPathExists, getWrittenFiles } = require('./helpers/mock-device');
|
const { injectMockDevice, connectMockDevice, overrideFirmwareURLs, goToManualMode, readMockFile, mockPathExists, getWrittenFiles } = require('./helpers/mock-device');
|
||||||
const { parseTar } = require('./helpers/tar');
|
const { parseTar } = require('./helpers/tar');
|
||||||
|
|
||||||
@@ -83,8 +83,9 @@ test.describe('NickelMenu', () => {
|
|||||||
expect(zipFiles).toContainEqual('.kobo/KoboRoot.tgz');
|
expect(zipFiles).toContainEqual('.kobo/KoboRoot.tgz');
|
||||||
// Must contain NickelMenu items config
|
// Must contain NickelMenu items config
|
||||||
expect(zipFiles).toContainEqual('.adds/nm/items');
|
expect(zipFiles).toContainEqual('.adds/nm/items');
|
||||||
// Must contain font files (fonts checkbox is checked by default)
|
// Must contain Readerly .ttf font files (readerly-fonts is checked by default)
|
||||||
expect(zipFiles.some(f => f.startsWith('fonts/'))).toBe(true);
|
const fontFiles = zipFiles.filter(f => f.startsWith('fonts/') && f.endsWith('.ttf'));
|
||||||
|
expect(fontFiles.length).toBeGreaterThan(0);
|
||||||
// Must NOT contain screensaver (unchecked by default)
|
// Must NOT contain screensaver (unchecked by default)
|
||||||
expect(zipFiles.some(f => f.startsWith('.kobo/screensaver/'))).toBe(false);
|
expect(zipFiles.some(f => f.startsWith('.kobo/screensaver/'))).toBe(false);
|
||||||
|
|
||||||
@@ -274,6 +275,10 @@ test.describe('NickelMenu', () => {
|
|||||||
expect(writtenFiles, 'KoboRoot.tgz should be written').toContainEqual(expect.stringContaining('KoboRoot.tgz'));
|
expect(writtenFiles, 'KoboRoot.tgz should be written').toContainEqual(expect.stringContaining('KoboRoot.tgz'));
|
||||||
expect(writtenFiles, 'NickelMenu items should be written').toContainEqual(expect.stringContaining('items'));
|
expect(writtenFiles, 'NickelMenu items should be written').toContainEqual(expect.stringContaining('items'));
|
||||||
|
|
||||||
|
// Verify Readerly font files were written (readerly-fonts is on by default)
|
||||||
|
const fontFiles = writtenFiles.filter(f => f.includes('fonts/') && f.endsWith('.ttf'));
|
||||||
|
expect(fontFiles.length, 'Readerly .ttf fonts should be written').toBeGreaterThan(0);
|
||||||
|
|
||||||
// Verify eReader.conf was updated with ExcludeSyncFolders
|
// Verify eReader.conf was updated with ExcludeSyncFolders
|
||||||
const conf = await readMockFile(page, '.kobo', 'Kobo', 'Kobo eReader.conf');
|
const conf = await readMockFile(page, '.kobo', 'Kobo', 'Kobo eReader.conf');
|
||||||
expect(conf, 'eReader.conf should contain ExcludeSyncFolders').toContain('ExcludeSyncFolders');
|
expect(conf, 'eReader.conf should contain ExcludeSyncFolders').toContain('ExcludeSyncFolders');
|
||||||
|
|||||||
Reference in New Issue
Block a user