mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-10 16:46:06 -08:00
Every supported host now takes dictionary ZIPs over the link, so remove the port 8780 upload, its hachidori.externalHostManagementUrl override and the hachidori config section. A linked host without linked-import-v1 now reports the update or manual-import fix.
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { resolveConfig } from '../resolve';
|
|
import { buildConfigSettingsRegistry } from '../settings/registry';
|
|
import { createResolveContext } from './context';
|
|
import { applyCoreDomainConfig } from './core-domains';
|
|
|
|
test('dictionary backend defaults to Yomitan and accepts Hachidori', () => {
|
|
assert.equal(resolveConfig({}).resolved.dictionaryBackend, 'yomitan');
|
|
const { resolved, warnings } = resolveConfig({ dictionaryBackend: 'hachidori' });
|
|
assert.equal(resolved.dictionaryBackend, 'hachidori');
|
|
assert.deepEqual(warnings, []);
|
|
const field = buildConfigSettingsRegistry(resolved).find(
|
|
(entry) => entry.configPath === 'dictionaryBackend',
|
|
);
|
|
assert.equal(field?.restartBehavior, 'restart');
|
|
assert.deepEqual(field?.enumValues, ['yomitan', 'hachidori']);
|
|
assert.equal(field?.category, 'integrations');
|
|
});
|
|
|
|
test('unknown dictionary backend values warn and preserve the default', () => {
|
|
for (const dictionaryBackend of ['unknown', '', null, true, {}]) {
|
|
const { context, warnings } = createResolveContext({});
|
|
context.src.dictionaryBackend = dictionaryBackend;
|
|
applyCoreDomainConfig(context);
|
|
assert.equal(context.resolved.dictionaryBackend, 'yomitan');
|
|
assert.equal(warnings.length, 1);
|
|
assert.equal(warnings[0]?.path, 'dictionaryBackend');
|
|
}
|
|
});
|