-
-
Notifications
You must be signed in to change notification settings - Fork 768
/
Copy pathformat-base-uri.test.ts
31 lines (25 loc) · 1.12 KB
/
format-base-uri.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { formatBaseUri } from './format-base-uri';
test('formatBaseUri returns the correct path when the path is the right format', () => {
const result = formatBaseUri('/hosted');
expect(result === '/hosted').toBe(true);
});
test('formatBaseUri returns the correct path when the path lacking initial slash', () => {
const result = formatBaseUri('hosted');
expect(result === '/hosted').toBe(true);
});
test('formatBaseUri returns the correct path when the path has both initial and trailing slash', () => {
const result = formatBaseUri('/hosted/');
expect(result === '/hosted').toBe(true);
});
test('formatBaseUri returns the correct path when the path has only trailing slash', () => {
const result = formatBaseUri('hosted/');
expect(result === '/hosted').toBe(true);
});
test('formatBaseUri returns empty string when called without input', () => {
const result = formatBaseUri(undefined);
expect(result === '').toBe(true);
});
test('formatBaseUri handles levels of paths', () => {
const result = formatBaseUri('hosted/multi/path');
expect(result === '/hosted/multi/path').toBe(true);
});