@uxland/primary-shell 7.11.4 → 7.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,7 @@ vi.mock("../../disposer", () => ({
20
20
  const createMockApi = (): PrimariaApi =>
21
21
  ({
22
22
  pluginBusyManager: {
23
- getBusyPluginTasks: vi.fn(),
23
+ getTasks: vi.fn(),
24
24
  },
25
25
  interactionService: {
26
26
  confirm: vi.fn(),
@@ -42,7 +42,7 @@ describe("ExitShellHandler", () => {
42
42
 
43
43
  it("should dispose and raise custom close event if no busy tasks and message has ecapEvent", async () => {
44
44
  const message = { ecapEvent: {} } as ExitShell;
45
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
45
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
46
46
  (disposePlugins as any).mockResolvedValue(undefined);
47
47
 
48
48
  await handler.handle(message);
@@ -54,7 +54,7 @@ describe("ExitShellHandler", () => {
54
54
 
55
55
  it("should dispose and raise default close event if no busy tasks and no ecapEvent in message", async () => {
56
56
  const message = {} as ExitShell;
57
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
57
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
58
58
  (disposePlugins as any).mockResolvedValue(undefined);
59
59
 
60
60
  await handler.handle(message);
@@ -68,7 +68,7 @@ describe("ExitShellHandler", () => {
68
68
  it("should ask for confirmation if there are busy tasks", async () => {
69
69
  const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
70
70
  const message = { ecapEvent: {} } as ExitShell;
71
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue(busyTasks);
71
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue(busyTasks);
72
72
  mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: true });
73
73
  (disposePlugins as any).mockResolvedValue(undefined);
74
74
 
@@ -92,7 +92,7 @@ describe("ExitShellHandler", () => {
92
92
  it("should not continue if confirmation is declined", async () => {
93
93
  const busyTasks: PluginBusyTask[] = [{ pluginId: "x" }] as any;
94
94
  const message = { ecapEvent: {} } as ExitShell;
95
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue(busyTasks);
95
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue(busyTasks);
96
96
  mockApi.interactionService.confirm = vi.fn().mockResolvedValue({ confirmed: false });
97
97
 
98
98
  await handler.handle(message);
@@ -107,7 +107,7 @@ describe("ExitShellHandler", () => {
107
107
  it("should handle errors and raise custom close event if message has ecapEvent", async () => {
108
108
  const error = new Error("Something went wrong");
109
109
  const message = { ecapEvent: {} } as ExitShell;
110
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
110
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
111
111
  (disposePlugins as any).mockRejectedValue(error);
112
112
 
113
113
  await handler.handle(message);
@@ -120,7 +120,7 @@ describe("ExitShellHandler", () => {
120
120
  it("should handle errors and raise default close event if message has no ecapEvent", async () => {
121
121
  const error = new Error("Something went wrong");
122
122
  const message = {} as ExitShell;
123
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
123
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
124
124
  (disposePlugins as any).mockRejectedValue(error);
125
125
 
126
126
  await handler.handle(message);
@@ -132,7 +132,7 @@ describe("ExitShellHandler", () => {
132
132
 
133
133
  it("should proceed if disposePlugins takes longer than 10 seconds", async () => {
134
134
  const message = { ecapEvent: {} } as ExitShell;
135
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
135
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
136
136
  (disposePlugins as any).mockImplementation(() => new Promise((resolve) => setTimeout(resolve, 11000)));
137
137
 
138
138
  await handler.handle(message);
@@ -143,7 +143,7 @@ describe("ExitShellHandler", () => {
143
143
  }, 15000);
144
144
 
145
145
  it("should raise raiseCloseEvent if no exitEvent is passed", async () => {
146
- mockApi.pluginBusyManager.getBusyPluginTasks = vi.fn().mockReturnValue([]);
146
+ mockApi.pluginBusyManager.getTasks = vi.fn().mockReturnValue([]);
147
147
  (disposePlugins as any).mockResolvedValue(undefined);
148
148
 
149
149
  await handler.handle(undefined as any);
@@ -14,7 +14,7 @@ export class ExitShellHandler {
14
14
  const evt = exitEvent && exitEvent.ecapEvent !== undefined ? exitEvent : undefined;
15
15
 
16
16
  try {
17
- const busyTasks = this.api.pluginBusyManager.getBusyPluginTasks();
17
+ const busyTasks = this.api.pluginBusyManager.getTasks();
18
18
  if (busyTasks.length > 0) {
19
19
  const { confirmed } = await this.askForClose(busyTasks);
20
20
  if (!confirmed) return;