Compare commits

...

2 Commits

Author SHA1 Message Date
sudacode 4cb0dbfaad Remove vendor source-inspection tests from yomitan-settings (#67) 2026-05-15 03:06:05 -07:00
sudacode 801cdcafca fix(docs): update Plausible proxy hostname to worker.sudacode.com
- Change `PLAUSIBLE_PROXY_HOSTNAME` from `worker.subminer.moe` to `worker.sudacode.com`
- Update test assertion to match new hostname
2026-05-15 02:13:20 -07:00
5 changed files with 7 additions and 58 deletions
@@ -0,0 +1,4 @@
type: internal
area: tests
- Removed stale Yomitan vendor source-inspection assertions for changes that were not shipped.
+1 -1
View File
@@ -1,5 +1,5 @@
const DOCS_HOSTNAME = 'https://docs.subminer.moe';
const PLAUSIBLE_PROXY_HOSTNAME = 'https://worker.subminer.moe';
const PLAUSIBLE_PROXY_HOSTNAME = 'https://worker.sudacode.com';
const PLAUSIBLE_SITE_SCRIPT_PATH = '/js/pa-h28Pn9ppgTJRmiSJlyPT6.js';
const PLAUSIBLE_ENDPOINT = `${PLAUSIBLE_PROXY_HOSTNAME}/api/event`;
const PLAUSIBLE_INIT_SCRIPT = [
+1 -1
View File
@@ -11,7 +11,7 @@ const docsPackageContents = readFileSync(docsPackagePath, 'utf8');
test('docs site loads the docs.subminer.moe Plausible script through the analytics proxy', () => {
expect(docsConfigContents).toContain("const DOCS_HOSTNAME = 'https://docs.subminer.moe'");
expect(docsConfigContents).toContain(
"const PLAUSIBLE_PROXY_HOSTNAME = 'https://worker.subminer.moe'",
"const PLAUSIBLE_PROXY_HOSTNAME = 'https://worker.sudacode.com'",
);
expect(docsConfigContents).toContain(
"const PLAUSIBLE_SITE_SCRIPT_PATH = '/js/pa-h28Pn9ppgTJRmiSJlyPT6.js'",
@@ -1,5 +1,4 @@
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
import {
@@ -9,19 +8,6 @@ import {
showYomitanSettingsWindow,
} from './yomitan-settings';
function assertGuardedBySubminerSettingsSafe(source: string, call: string): void {
const callIndex = source.indexOf(call);
assert.notEqual(callIndex, -1, `missing call: ${call}`);
const beforeCall = source.slice(0, callIndex);
const guardIndex = beforeCall.lastIndexOf('if (!subminerSettingsSafe) {');
const blockCloseIndex = beforeCall.lastIndexOf('\n }');
assert.ok(
guardIndex > blockCloseIndex,
`${call} must be inside its own !subminerSettingsSafe startup guard`,
);
}
test('yomitan settings window removes default app menu quit action', () => {
const calls: string[] = [];
@@ -40,48 +26,6 @@ test('yomitan settings URL disables the embedded popup preview', () => {
);
});
test('vendored Yomitan settings safe mode skips heavy startup controllers', () => {
const source = readFileSync(
'vendor/subminer-yomitan/ext/js/pages/settings/settings-main.js',
'utf8',
);
assert.match(source, /subminer-settings-safe/);
assertGuardedBySubminerSettingsSafe(source, 'popupPreviewController.prepare()');
assertGuardedBySubminerSettingsSafe(source, 'persistentStorageController.prepare()');
assertGuardedBySubminerSettingsSafe(source, 'storageController.prepare()');
assertGuardedBySubminerSettingsSafe(source, 'dictionaryController.prepare()');
assertGuardedBySubminerSettingsSafe(source, 'ankiController.prepare()');
assert.match(source, /if \(!subminerSettingsSafe\)[\s\S]*new AnkiDeckGeneratorController/);
assert.match(source, /if \(!subminerSettingsSafe\)[\s\S]*new SecondarySearchDictionaryController/);
assert.match(source, /if \(!subminerSettingsSafe\)[\s\S]*new SortFrequencyDictionaryController/);
});
test('vendored Yomitan settings caches dictionary metadata requests', () => {
const source = readFileSync(
'vendor/subminer-yomitan/ext/js/pages/settings/settings-controller.js',
'utf8',
);
assert.match(source, /_dictionaryInfoPromise/);
assert.match(source, /_dictionaryInfoCache/);
assert.match(source, /databaseUpdated/);
assert.match(
source,
/this\._dictionaryInfoPromise = this\._application\.api\.getDictionaryInfo\(\)/,
);
});
test('vendored Yomitan Anki settings reuses SettingsController dictionary metadata cache', () => {
const source = readFileSync(
'vendor/subminer-yomitan/ext/js/pages/settings/anki-controller.js',
'utf8',
);
assert.match(source, /this\._settingsController\.getDictionaryInfo\(\)/);
assert.doesNotMatch(source, /this\._application\.api\.getDictionaryInfo\(\)/);
});
test('showYomitanSettingsWindow restores, repaints, shows, and focuses an existing window', () => {
const calls: string[] = [];
+1
View File
@@ -575,6 +575,7 @@ test('numeric selection ignores non-digit keys instead of falling through to oth
testGlobals.commandEvents.some((event) => event.type === 'forwardKeyDown'),
false,
);
testGlobals.dispatchKeydown({ key: 'Escape', code: 'Escape' });
} finally {
testGlobals.restore();
}