Skip to content

Commit

Permalink
Add test to test account details
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Dufour <[email protected]>
  • Loading branch information
outscale-mdr committed Jan 18, 2024
1 parent b86b672 commit 9ebcceb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/cloud/mock/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const account: osc.Account = {

export function initMock() {
const getAccountMock = ImportMock.mockFunction(osc.AccountApi.prototype, 'readAccounts');
getAccountMock.onFirstCall().returns(Promise.reject("403"));
getAccountMock.returns(Promise.resolve(
{
accounts: [account],
Expand Down
28 changes: 26 additions & 2 deletions src/ui-test/treeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,33 @@ describe('ActivityBar', () => {
expect(await menu.hasItem(expectedCommandName)).equals(true);
});

it('has show Account Info button', async () => {
describe('has show Account Info button', async () => {
const expectedCommandName = getButtonTitle("osc.showAccountInfo");
expect(await menu.hasItem(expectedCommandName)).equals(true);

after(async () => {
await (new EditorView()).closeAllEditors();
});

it("exists", async () => {
expect(await menu.hasItem(expectedCommandName)).equals(true);
});

it("shows resource detail when clicking", async () => {
const action = await menu.getItem(expectedCommandName);
await action?.select();

await delay(500);

// New titles in editor
const editor = new TextEditor();
expect(await editor.getTitle()).equals("first_profile.json");
const data = await editor.getText();
const account = osc.AccountFromJSON(JSON.parse(data));
expect(account.accountId).equals("accountid");

const editorView = new EditorView();
await editorView.closeEditor("first_profile.json");
});
});
});

Expand Down

0 comments on commit 9ebcceb

Please sign in to comment.