mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
refactor: extract app shutdown orchestration service
This commit is contained in:
32
src/core/services/app-shutdown-runtime-service.test.ts
Normal file
32
src/core/services/app-shutdown-runtime-service.test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { runAppShutdownRuntimeService } from "./app-shutdown-runtime-service";
|
||||
|
||||
test("runAppShutdownRuntimeService runs teardown steps in order", () => {
|
||||
const calls: string[] = [];
|
||||
runAppShutdownRuntimeService({
|
||||
unregisterAllGlobalShortcuts: () => calls.push("unregisterAllGlobalShortcuts"),
|
||||
stopSubtitleWebsocket: () => calls.push("stopSubtitleWebsocket"),
|
||||
stopTexthookerService: () => calls.push("stopTexthookerService"),
|
||||
destroyYomitanParserWindow: () => calls.push("destroyYomitanParserWindow"),
|
||||
clearYomitanParserPromises: () => calls.push("clearYomitanParserPromises"),
|
||||
stopWindowTracker: () => calls.push("stopWindowTracker"),
|
||||
destroyMpvSocket: () => calls.push("destroyMpvSocket"),
|
||||
clearReconnectTimer: () => calls.push("clearReconnectTimer"),
|
||||
destroySubtitleTimingTracker: () => calls.push("destroySubtitleTimingTracker"),
|
||||
destroyAnkiIntegration: () => calls.push("destroyAnkiIntegration"),
|
||||
});
|
||||
|
||||
assert.deepEqual(calls, [
|
||||
"unregisterAllGlobalShortcuts",
|
||||
"stopSubtitleWebsocket",
|
||||
"stopTexthookerService",
|
||||
"destroyYomitanParserWindow",
|
||||
"clearYomitanParserPromises",
|
||||
"stopWindowTracker",
|
||||
"destroyMpvSocket",
|
||||
"clearReconnectTimer",
|
||||
"destroySubtitleTimingTracker",
|
||||
"destroyAnkiIntegration",
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user