The new "Book Downloads" group in Settings holds a Calibre template for the file name of a direct download. Without a template, the name stays the title. The name is also the title if the template fails or gives no name for a book.
27 lines
1.2 KiB
JavaScript
27 lines
1.2 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { test } from 'node:test';
|
|
import { find, install, server, settle } from './flow-helpers.mjs';
|
|
|
|
const ui = install();
|
|
const { stopPolling } = await import('../../bindery/static/js/jobs.js');
|
|
|
|
test('a user who is not an admin gets no settings link and no settings page', async (t) => {
|
|
t.after(stopPolling);
|
|
const backend = server(t);
|
|
backend.on('GET', 'auth/check', { authenticated: true, mode: 'proxy', user: 'bob', admin: false });
|
|
backend.on('GET', 'config', { metadata_fields: {}, mode_labels: {}, library_available: false, download_fields: {} });
|
|
backend.on('GET', 'jobs', []);
|
|
backend.on('GET', 'stories', []);
|
|
await import('../../bindery/static/js/main.js');
|
|
await settle();
|
|
assert.ok(find(ui.app, 'a', 'Stories'));
|
|
assert.equal(find(ui.app, 'a', 'Settings'), undefined);
|
|
window.location.hash = '#/settings';
|
|
ui.windowEvents.hashchange();
|
|
await settle();
|
|
assert.match(ui.app.textContent, /Only an admin can open the settings/);
|
|
// The page asks the server for no settings and no rules.
|
|
assert.deepEqual(backend.sent('GET', 'settings'), []);
|
|
assert.deepEqual(backend.sent('GET', 'rules'), []);
|
|
});
|