Skip to content

Commit 1250b26

Browse files
committed
add more test cases for removeHyphens function
1 parent 50eebc8 commit 1250b26

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

__test__/removeHyphens.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ test("removeHyphens() should all hyphens from a string of text", () => {
55
expect(removeHyphens("not the definition of insanity - e=mc2")).toEqual(
66
"not the definition of insanity e=mc2"
77
);
8+
expect(removeHyphens("")).toEqual("");
9+
expect(removeHyphens(null)).toEqual(null);
810
});

src/utils/removeHyphens.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const removeHyphens = string => (!string ? string : string.replace(/-/g, " "));
1+
const removeHyphens = string => string.replace(/-/g, " ");
22

33
export default removeHyphens;

0 commit comments

Comments
 (0)