From 413734f1d9ffc386f691fc97d79fa12722c6e1e5 Mon Sep 17 00:00:00 2001 From: Philippe Ozil Date: Thu, 23 May 2024 16:30:17 +0200 Subject: [PATCH] feat: align platformWorkspaceApi with official PR --- .../jest-mocks/lightning/platformWorkspaceApi.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/force-app/test/jest-mocks/lightning/platformWorkspaceApi.js b/force-app/test/jest-mocks/lightning/platformWorkspaceApi.js index 3884c3203..d2ab5af85 100644 --- a/force-app/test/jest-mocks/lightning/platformWorkspaceApi.js +++ b/force-app/test/jest-mocks/lightning/platformWorkspaceApi.js @@ -1,27 +1,26 @@ import { createTestWireAdapter } from '@salesforce/wire-service-jest-util'; -// Mock values that are not part of lightning/platformWorkspaceApi +// Mock values that are not part of the lightning/platformWorkspaceApi signature +// In this default test scenario, we assume that two tabs are open, and the first one is focused export const TAB0 = 'tab0'; export const TAB1 = 'tab1'; -// In our mock, we assume that two tabs are open, and the first one is focused export const FOCUSED_TAB_ID = TAB0; export const ENCLOSING_TAB_ID = TAB0; +export const OPEN_TABS = [{ tabId: TAB0 }, { tabId: TAB1 }]; -// Mocked methods and attributes from lightning/platformWorkspaceApi +// Mocked methods and wires that are part of the lightning/platformWorkspaceApi signature export const closeTab = jest.fn().mockResolvedValue(true); export const disableTabClose = jest.fn().mockResolvedValue(true); export const focusTab = jest.fn().mockResolvedValue(true); -export const getAllTabInfo = jest - .fn() - .mockResolvedValue([{ tabId: TAB0 }, { tabId: 'tab1' }]); +export const getAllTabInfo = jest.fn().mockResolvedValue(OPEN_TABS); export const getFocusedTabInfo = jest.fn().mockResolvedValue({ tabId: TAB0 }); export const getTabInfo = jest.fn().mockResolvedValue({ tabId: TAB0 }); export const openSubtab = jest.fn().mockResolvedValue(true); export const openTab = jest.fn().mockResolvedValue(true); export const refreshTab = jest.fn().mockResolvedValue(true); -export const setTabHighlighted = jest.fn().mockResolvedValue(true); export const setTabIcon = jest.fn().mockResolvedValue(true); export const setTabLabel = jest.fn().mockResolvedValue(true); +export const setTabHighlighted = jest.fn().mockResolvedValue(true); export const EnclosingTabId = createTestWireAdapter(jest.fn()); export const IsConsoleNavigation = createTestWireAdapter(jest.fn());