Skip to content

Commit

Permalink
Changing name and placing the test next to useFloatingLinkState.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizFNJ committed Feb 3, 2025
1 parent cbf7f6a commit f85f330
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
5 changes: 3 additions & 2 deletions server/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"moduleFileExtensions": [
"js",
"json",
"ts"
"ts",
"jsx"
],
"rootDir": "./",
"rootDir": "../",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
Expand Down
29 changes: 0 additions & 29 deletions server/test-unit/urlValidation.spec.ts

This file was deleted.

30 changes: 30 additions & 0 deletions src/components/Collaborative/hooks/useFloatingLinkState.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
describe("URL Validation Tests", () => {
const URL_PATTERN =
/^(ftp|http|https):\/\/[^ "]+\.[a-zA-Z]{2,}(\/|\?|#|$)/;

const validUrls = [
"https://example.com",
"https://example.br",
"https://example.org",
"https://example.net",
"https://example.edu",
"https://example.gov",
"https://example.mil",
"https://example.co",
"https://example.info",
"https://example.io",
"https://example.biz",
"https://example.us",
"https://example.uk",
"ftp://example.com",
"http://example.co",
"https://subdomain.example.org"
];

validUrls.forEach((url) => {
it(`should accept the URL: ${url}`, () => {
expect(URL_PATTERN.test(url)).toBe(true);
});
});
});
export {}

0 comments on commit f85f330

Please sign in to comment.