-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3884283
commit 3b6badb
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { formatName } from "../../../src/helpers/formatName" | ||
|
||
describe("formatName", () => { | ||
it('should replace spaces with "%" and add "%" at the end', () => { | ||
expect(formatName("John Doe")).toBe("John%Doe%") | ||
}) | ||
|
||
it('should replace "*" with "%" and add "%" at the end', () => { | ||
expect(formatName("John*Doe")).toBe("John%Doe%") | ||
}) | ||
|
||
it('should not add another "%" if already present at the end', () => { | ||
expect(formatName("John Doe%")).toBe("John%Doe%") | ||
}) | ||
|
||
it('should add "%" if there are no spaces or special characters', () => { | ||
expect(formatName("John")).toBe("John%") | ||
}) | ||
|
||
it("should handle empty string", () => { | ||
expect(formatName("")).toBe("%") | ||
}) | ||
}) |