Skip to content

Commit d552e76

Browse files
committed
test: add test for stripTrailingSlash method
1 parent 7b2793a commit d552e76

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/helper.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { stripTrailingSlash } from '../src/lib/helpers'
2+
3+
test('Strip trailing slash from URL', () => {
4+
const URL = 'http://localhost:3000/'
5+
const expectedURL = URL.slice(0, -1)
6+
expect(stripTrailingSlash(URL)).toBe(expectedURL)
7+
})
8+
9+
test('Return the original URL if there is no slash at the end', () => {
10+
const URL = 'http://localhost:3000'
11+
const expectedURL = URL
12+
expect(stripTrailingSlash(URL)).toBe(expectedURL)
13+
})

0 commit comments

Comments
 (0)