Prepare Windows release and signing process (#16)

This commit is contained in:
2026-03-08 19:51:30 -07:00
committed by GitHub
parent 34d2dce8dc
commit c799a8de3c
113 changed files with 5042 additions and 386 deletions

View File

@@ -0,0 +1,66 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import type { AnkiConnectConfig } from '../../types';
import {
getPreferredYomitanAnkiServerUrl,
shouldForceOverrideYomitanAnkiServer,
} from './yomitan-anki-server';
function createConfig(overrides: Partial<AnkiConnectConfig> = {}): AnkiConnectConfig {
return {
enabled: false,
url: 'http://127.0.0.1:8765',
proxy: {
enabled: true,
host: '127.0.0.1',
port: 8766,
upstreamUrl: 'http://127.0.0.1:8765',
},
...overrides,
} as AnkiConnectConfig;
}
test('prefers upstream AnkiConnect when SubMiner integration is disabled', () => {
const config = createConfig({
enabled: false,
proxy: {
enabled: true,
host: '127.0.0.1',
port: 8766,
upstreamUrl: 'http://127.0.0.1:8765',
},
});
assert.equal(getPreferredYomitanAnkiServerUrl(config), 'http://127.0.0.1:8765');
assert.equal(shouldForceOverrideYomitanAnkiServer(config), false);
});
test('prefers SubMiner proxy when SubMiner integration and proxy are enabled', () => {
const config = createConfig({
enabled: true,
proxy: {
enabled: true,
host: '127.0.0.1',
port: 9988,
upstreamUrl: 'http://127.0.0.1:8765',
},
});
assert.equal(getPreferredYomitanAnkiServerUrl(config), 'http://127.0.0.1:9988');
assert.equal(shouldForceOverrideYomitanAnkiServer(config), true);
});
test('falls back to upstream AnkiConnect when proxy transport is disabled', () => {
const config = createConfig({
enabled: true,
proxy: {
enabled: false,
host: '127.0.0.1',
port: 8766,
upstreamUrl: 'http://127.0.0.1:8765',
},
});
assert.equal(getPreferredYomitanAnkiServerUrl(config), 'http://127.0.0.1:8765');
assert.equal(shouldForceOverrideYomitanAnkiServer(config), false);
});