Skip to content

Commit 027cac6

Browse files
committed
refactor(tests): switch to assertions instead of expect
1 parent 888e604 commit 027cac6

File tree

4 files changed

+10
-120
lines changed

4 files changed

+10
-120
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ Keymaps
1818

1919
`ctrl-alt-cmd-z` - Clear all `:focus` tags from current open buffer.
2020

21-
## Development
22-
23-
Tests use a BDD style (`describe` / `it` / `expect`) with Mocha and Chai. Run with `npm test`.
24-
2521
## Release Notes
2622

2723
Full changelog available at [CHANGELOG.md](./CHANGELOG.md)

package-lock.json

Lines changed: 0 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,10 @@
8888
"devDependencies": {
8989
"@eslint/compat": "^2.0.2",
9090
"@eslint/js": "^10.0.1",
91-
"@types/chai": "^4.3.0",
9291
"@types/mocha": "^10.0.10",
9392
"@types/node": "^22.19.13",
9493
"@types/vscode": "^1.95.0",
9594
"@vscode/test-electron": "^2.5.2",
96-
"chai": "^4.5.0",
9795
"eslint": "^10.0.2",
9896
"eslint-config-prettier": "^10.1.8",
9997
"eslint-plugin-prettier": "^5.5.5",

test/extension.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect } from 'chai';
1+
import assert from 'node:assert';
22
import vscode from 'vscode';
33

44
describe('RSpec Focus', () => {
@@ -18,7 +18,7 @@ describe('RSpec Focus', () => {
1818

1919
await vscode.commands.executeCommand('rspec-focus.add');
2020

21-
expect(editor.document.lineAt(0).text).to.equal("it 'does something', :focus do");
21+
assert.strictEqual(editor.document.lineAt(0).text, "it 'does something', :focus do");
2222
});
2323

2424
it("adds :focus tag to 'describe' block", async () => {
@@ -28,7 +28,7 @@ describe('RSpec Focus', () => {
2828

2929
await vscode.commands.executeCommand('rspec-focus.add');
3030

31-
expect(editor.document.lineAt(0).text).to.equal("describe 'User', :focus do");
31+
assert.strictEqual(editor.document.lineAt(0).text, "describe 'User', :focus do");
3232
});
3333

3434
it('adds :focus tag to RSpec.describe block', async () => {
@@ -38,7 +38,7 @@ describe('RSpec Focus', () => {
3838

3939
await vscode.commands.executeCommand('rspec-focus.add');
4040

41-
expect(editor.document.lineAt(0).text).to.equal("RSpec.describe 'User', :focus do");
41+
assert.strictEqual(editor.document.lineAt(0).text, "RSpec.describe 'User', :focus do");
4242
});
4343

4444
it('adds :focus to nearest block when cursor is inside nested block', async () => {
@@ -48,7 +48,7 @@ describe('RSpec Focus', () => {
4848

4949
await vscode.commands.executeCommand('rspec-focus.add');
5050

51-
expect(editor.document.lineAt(1).text).to.equal(" it 'is valid', :focus do");
51+
assert.strictEqual(editor.document.lineAt(1).text, " it 'is valid', :focus do");
5252
});
5353

5454
it('does not add focus when tag is already present', async () => {
@@ -58,7 +58,7 @@ describe('RSpec Focus', () => {
5858

5959
await vscode.commands.executeCommand('rspec-focus.add');
6060

61-
expect(editor.document.lineAt(0).text).to.equal("it 'is valid', :focus do");
61+
assert.strictEqual(editor.document.lineAt(0).text, "it 'is valid', :focus do");
6262
});
6363
});
6464

@@ -69,8 +69,8 @@ describe('RSpec Focus', () => {
6969

7070
await vscode.commands.executeCommand('rspec-focus.clear');
7171

72-
expect(editor.document.lineAt(0).text).to.equal("describe 'User' do");
73-
expect(editor.document.lineAt(1).text).to.equal(" it 'is valid' do");
72+
assert.strictEqual(editor.document.lineAt(0).text, "describe 'User' do");
73+
assert.strictEqual(editor.document.lineAt(1).text, " it 'is valid' do");
7474
});
7575
});
7676

@@ -86,10 +86,10 @@ describe('RSpec Focus', () => {
8686
editor.selection = new vscode.Selection(new vscode.Position(0, 0), new vscode.Position(0, 0));
8787

8888
await vscode.commands.executeCommand('rspec-focus.add');
89-
expect(editor.document.lineAt(0).text).to.equal("it 'work in progress', :wip do");
89+
assert.strictEqual(editor.document.lineAt(0).text, "it 'work in progress', :wip do");
9090

9191
await vscode.commands.executeCommand('rspec-focus.clear');
92-
expect(editor.document.lineAt(0).text).to.equal("it 'work in progress' do");
92+
assert.strictEqual(editor.document.lineAt(0).text, "it 'work in progress' do");
9393
} finally {
9494
await config.update('focusTag', original, vscode.ConfigurationTarget.Global);
9595
}

0 commit comments

Comments
 (0)