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

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
darangi committed Nov 15, 2019
1 parent 010206a commit 8c665d7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/text-buffer-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const path = require('path');
const TextBuffer = require ('../src/text-buffer');

describe('when a buffer is already open', () => {
it('replaces foo( with bar( using /\bfoo\(\b/gim', () => {
const filePath = path.join(__dirname, 'fixtures','sample.js');
const buffer = new TextBuffer();
buffer.setPath(filePath);
buffer.setText('foo(x)');
buffer.replace(/\bfoo\(\b/gim,'bar(');

expect(buffer.getText()).toBe('bar(x)');
});
});

0 comments on commit 8c665d7

Please # to comment.