Find & Replace


The user enters a phrase and two words, the first word is replaced with the second word.

Below in the code example you can see the most basic tests written for this project. BDD or behavior-driven development is a fantastic process for building your application piece by piece.

In the first step we confirm that we return a string since that is the most basic and universal bit of information. In the second test, we look for a more specific string to be return.

code highlight: 
    it("intputs a phrase, and two words and replace the first with the second word", function() {
        expect(findReplace('hello world', 'hello', 'goodbye')).to.equal('goodbye world');

    it("handles common punctution correctly", function() {
        expect(findReplace('Hello, world!', 'Hello', 'Goodbye')).to.equal('Goodbye, world!');

See the Pen Find and Replace by charlie (@CharlesAMoss) on CodePen.