-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Collapse All Apex Tests functionality @W-16273375@ (#5684)
* feat: adds collapse all apex test functionality to testing side panel * fix: update to type guard via @peternhale code review feedback * fix: update to type guard via @peternhale code review feedback * Revert "fix: update to type guard via @peternhale code review feedback" This reverts commit 7e69e45. * Updates initial state to expanded for test groups by default * Adds Collapse All functionality to LWC test pane as well * fix: updates typo in new packages\salesforcedx-vscode-lwc\test\jest\testExplorer\testOutlineProvider.test.ts test file * fix: standardize ordering of LWC/Apex test pane action buttons --------- Co-authored-by: peternhale <[email protected]>
- Loading branch information
1 parent
1a92295
commit 2f88e43
Showing
17 changed files
with
248 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/salesforcedx-vscode-apex/resources/dark/collapse-all.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
packages/salesforcedx-vscode-apex/resources/light/collapse-all.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/salesforcedx-vscode-apex/test/jest/views/testOutlineProvider.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2024, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
|
||
import * as vscode from 'vscode'; | ||
import { iconHelpers } from '../../../src/views/icons/iconHelpers'; | ||
|
||
import { getTestOutlineProvider } from '../../../src/views/testOutlineProvider'; | ||
|
||
describe('testOutlineProvider Unit Tests.', () => { | ||
const vscodeMocked = jest.mocked(vscode); | ||
let commandMock: jest.SpyInstance; | ||
|
||
beforeEach(() => { | ||
// testOutlineProvider has a hidden dependency on iconHelpers.getIconPath that needs to be mocked | ||
// for our purposes, the return value has no bearing on what we're testing | ||
jest | ||
.spyOn(iconHelpers, 'getIconPath') | ||
.mockReturnValue(vscode.Uri.parse('https://salesforce.com')); | ||
commandMock = jest.spyOn(vscodeMocked.commands, 'executeCommand'); | ||
}); | ||
|
||
it('sets test outline provider id', () => { | ||
const provider = getTestOutlineProvider(); | ||
expect(provider.getId()).toBe('sf.test.view'); | ||
}); | ||
|
||
it('calls collapse all apex tests', () => { | ||
const provider = getTestOutlineProvider(); | ||
|
||
void provider.collapseAll(); | ||
|
||
expect(commandMock.mock.calls.length).toBe(1); | ||
expect(commandMock.mock.calls[0].length).toBe(1); | ||
expect(commandMock.mock.calls[0][0]).toBe( | ||
`workbench.actions.treeView.${provider.getId()}.collapseAll` | ||
); | ||
}); | ||
}); |
Oops, something went wrong.