Skip to content

Commit 5a06010

Browse files
committed
Changing name and placing the test next to useFloatingLinkState.tsx
1 parent cbf7f6a commit 5a06010

File tree

3 files changed

+31
-30
lines changed

3 files changed

+31
-30
lines changed

server/jest.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"json",
66
"ts"
77
],
8-
"rootDir": "./",
8+
"rootDir": "../",
99
"testRegex": ".*\\.spec\\.ts$",
1010
"transform": {
1111
"^.+\\.(t|j)s$": "ts-jest"

server/test-unit/urlValidation.spec.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
describe("URL Validation Tests", () => {
2+
const URL_PATTERN =
3+
/^(ftp|http|https):\/\/[^ "]+\.[a-zA-Z]{2,}(\/|\?|#|$)/;
4+
5+
const validUrls = [
6+
"https://example.com",
7+
"https://example.br",
8+
"https://example.org",
9+
"https://example.net",
10+
"https://example.edu",
11+
"https://example.gov",
12+
"https://example.mil",
13+
"https://example.co",
14+
"https://example.info",
15+
"https://example.io",
16+
"https://example.biz",
17+
"https://example.us",
18+
"https://example.uk",
19+
"ftp://example.com",
20+
"http://example.co",
21+
"https://subdomain.example.org"
22+
];
23+
24+
validUrls.forEach((url) => {
25+
it(`should accept the URL: ${url}`, () => {
26+
expect(URL_PATTERN.test(url)).toBe(true);
27+
});
28+
});
29+
});
30+
export {}

0 commit comments

Comments
 (0)