mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-31 07:35:24 +00:00
fix: keep plugins loaded after signing in from the login screen
This commit is contained in:
1 parent
8043d6dbdd
commit
4423c4c8ef
3 files changed
+48
-12
No files matched your search
@@ -7,6 +7,8 @@ import {
|
||||
isPluginFrontendActive,
|
||||
orderForActivation,
|
||||
resetPluginLoader,
|
||||
startPluginRuntime,
|
||||
startPreLoginPlugins,
|
||||
syncPlugins,
|
||||
} from "@/plugin-host/loader";
|
||||
import {
|
||||
@@ -208,6 +210,42 @@ describe("plugin loader", () => {
|
||||
expect(railIds()).not.toContain("headless-panel");
|
||||
});
|
||||
|
||||
it("keeps every plugin when the pre-login list lands after sign-in", async () => {
|
||||
modules.login = railPlugin("login");
|
||||
modules.alpha = railPlugin("alpha");
|
||||
plugins = [summary("login"), summary("alpha")];
|
||||
|
||||
let releasePreLogin: (value: Response) => void = () => {};
|
||||
vi.spyOn(globalThis, "fetch").mockImplementation(
|
||||
() =>
|
||||
new Promise<Response>((resolve) => {
|
||||
releasePreLogin = resolve;
|
||||
}),
|
||||
);
|
||||
|
||||
const preLogin = startPreLoginPlugins();
|
||||
await startPluginRuntime();
|
||||
releasePreLogin(new Response(JSON.stringify([summary("login")])));
|
||||
await preLogin;
|
||||
|
||||
expect(isPluginFrontendActive("login")).toBe(true);
|
||||
expect(isPluginFrontendActive("alpha")).toBe(true);
|
||||
});
|
||||
|
||||
it("ignores a pre-login load started after sign-in", async () => {
|
||||
modules.login = railPlugin("login");
|
||||
modules.alpha = railPlugin("alpha");
|
||||
plugins = [summary("login"), summary("alpha")];
|
||||
vi.spyOn(globalThis, "fetch").mockImplementation(
|
||||
async () => new Response(JSON.stringify([summary("login")])),
|
||||
);
|
||||
|
||||
await startPluginRuntime();
|
||||
await startPreLoginPlugins();
|
||||
|
||||
expect(isPluginFrontendActive("alpha")).toBe(true);
|
||||
});
|
||||
|
||||
it("settles even when the plugin list cannot be fetched", async () => {
|
||||
vi.spyOn(console, "error").mockImplementation(() => {});
|
||||
configurePluginLoader({
|
||||
|
||||
Reference in new issue
Block a user