Skip to content

Commit

Permalink
Use jest's expect in UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcomura committed Feb 21, 2025
1 parent 1eb76a1 commit 47b7f8b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 110 deletions.
7 changes: 3 additions & 4 deletions e2e/tests/auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from 'chai';
import { before, after, EditorView, Workbench, By, ActivityBar, SideBarView } from 'vscode-extension-tester';

describe('Auth User', async () => {
Expand Down Expand Up @@ -27,11 +26,11 @@ describe('Auth User', async () => {

it('in SideBarView should see Create issue... button', async () => {
const atlasDrawer = sideBarView.findElement(By.id('workbench.view.extension.atlascode-drawer'));
expect(atlasDrawer).to.not.be.undefined;
expect(atlasDrawer).toBeDefined();

Check failure on line 29 in e2e/tests/auth.test.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'expect'.

const createIssueButton = atlasDrawer.findElement(By.css('[aria-label="Create issue..."]'));
expect(createIssueButton).to.not.be.undefined;
expect(await createIssueButton.getText()).to.equal('Create issue...');
expect(createIssueButton).toBeDefined();

Check failure on line 32 in e2e/tests/auth.test.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'expect'.
expect(await createIssueButton.getText()).toEqual('Create issue...');

Check failure on line 33 in e2e/tests/auth.test.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'expect'.
});

it('in SideBarView should see a assigned JIRA issues', async () => {});
Expand Down
9 changes: 4 additions & 5 deletions e2e/tests/no-auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { expect } from 'chai';
import { before, ActivityBar, after, SideBarView, By, EditorView, Workbench } from 'vscode-extension-tester';

describe('Atlassian Extension Activity Bar', async () => {
Expand All @@ -15,7 +14,7 @@ describe('Atlassian Extension Activity Bar', async () => {
// Get title from every control
const titles = await Promise.all(controls.map(async (control) => control.getTitle()));

expect('Atlassian').to.be.oneOf(titles);
expect(titles).toContain('Atlassian');

Check failure on line 17 in e2e/tests/no-auth.test.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'expect'.
});
});

Expand All @@ -41,12 +40,12 @@ describe('Atlassian Extension SideBar', async () => {

it('should have a login action suggestion', async () => {
const atlasDrawer = sideBarView.findElement(By.id('workbench.view.extension.atlascode-drawer'));
expect(atlasDrawer).to.not.be.undefined;
expect(atlasDrawer).toBeDefined();

Check failure on line 43 in e2e/tests/no-auth.test.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'expect'.

// find element by aria-label: "Please login to Jira"
const loginButton = atlasDrawer.findElement(By.css('[aria-label="Please login to Jira"]'));
expect(loginButton).to.not.be.undefined;
expect(await loginButton.getText()).to.equal('Please login to Jira');
expect(loginButton).toBeDefined();

Check failure on line 47 in e2e/tests/no-auth.test.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'expect'.
expect(await loginButton.getText()).toEqual('Please login to Jira');

Check failure on line 48 in e2e/tests/no-auth.test.ts

View workflow job for this annotation

GitHub Actions / build

Cannot find name 'expect'.
});
});

Expand Down
100 changes: 0 additions & 100 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,6 @@
"ajv-formats": "^3.0.1",
"autoprefixer": "^10.4.20",
"babel-loader": "^9.2.1",
"chai": "^4",
"concurrently": "^9.1.2",
"cross-env": "^7.0.2",
"css-loader": "^7.1.2",
Expand Down

0 comments on commit 47b7f8b

Please sign in to comment.