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 3, 2024
1 parent 18f2607 commit ee08c8b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 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
30 changes: 27 additions & 3 deletions src/ui-test/treeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('ActivityBar', () => {
expect(action).not.undefined;
});

it.skip('open dialog', async function() {
it.skip('open dialog', async function () {
await action.click();
const input = new InputBox();
// Check the title
Expand Down 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 ee08c8b

Please sign in to comment.