Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 8c665d7

Browse files
committed
added test
1 parent 010206a commit 8c665d7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

spec/text-buffer-spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const path = require('path');
2+
const TextBuffer = require ('../src/text-buffer');
3+
4+
describe('when a buffer is already open', () => {
5+
it('replaces foo( with bar( using /\bfoo\(\b/gim', () => {
6+
const filePath = path.join(__dirname, 'fixtures','sample.js');
7+
const buffer = new TextBuffer();
8+
buffer.setPath(filePath);
9+
buffer.setText('foo(x)');
10+
buffer.replace(/\bfoo\(\b/gim,'bar(');
11+
12+
expect(buffer.getText()).toBe('bar(x)');
13+
});
14+
});

0 commit comments

Comments
 (0)