mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add OE node refresh API method (#2578)
* Initial working commit for refreshing OE node via API * Add test and fix up code * Run tsfmt * Fix test
This commit is contained in:
committed by
Karl Burtram
parent
36f7c283b8
commit
05040425df
@@ -301,7 +301,8 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
reveal: element => Promise.resolve() as Thenable<void>,
|
||||
setSelected: (element, selected, clearOtherSelections) => undefined,
|
||||
isExpanded: element => undefined,
|
||||
onSelectionOrFocusChange: Event.None
|
||||
onSelectionOrFocusChange: Event.None,
|
||||
refreshElement: (element) => Promise.resolve() as Thenable<void>
|
||||
} as ServerTreeView);
|
||||
});
|
||||
|
||||
@@ -738,4 +739,22 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
}, err => done(err));
|
||||
});
|
||||
});
|
||||
|
||||
test('refreshInView refreshes the node, expands it, and returns the refreshed node', async () => {
|
||||
// Set up the session and tree view
|
||||
await objectExplorerService.createNewSession('MSSQL', connection);
|
||||
objectExplorerService.onSessionCreated(1, objectExplorerSession);
|
||||
serverTreeView.setup(x => x.refreshElement(TypeMoq.It.isAny())).returns(() => Promise.resolve());
|
||||
objectExplorerService.registerServerTreeView(serverTreeView.object);
|
||||
|
||||
// Refresh the node
|
||||
let nodePath = objectExplorerSession.rootNode.nodePath;
|
||||
let refreshedNode = await objectExplorerService.refreshNodeInView(connection.id, nodePath);
|
||||
|
||||
// Verify that it was refreshed, expanded, and the refreshed detailed were returned
|
||||
sqlOEProvider.verify(x => x.refreshNode(TypeMoq.It.is(refreshNode => refreshNode.nodePath === nodePath)), TypeMoq.Times.once());
|
||||
refreshedNode.children.forEach((childNode, index) => {
|
||||
assert.equal(childNode.nodePath, objectExplorerExpandInfoRefresh.nodes[index].nodePath);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user