fix: remove redundant log in validLink and rename
This commit is contained in:
parent
62a0e85554
commit
24de7bcaa3
@ -5,7 +5,7 @@ import { settingsState } from "../state/settings";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { useState } from "react";
|
||||
import { normalizeURL } from "@/lib/normalizeURL";
|
||||
import validLink from "@/lib/url/valid_link";
|
||||
import validLink from "@/lib/url/validLink";
|
||||
|
||||
export default function Search(props: { onFocus: () => void }) {
|
||||
const settings: settings = useRecoilValue(settingsState);
|
||||
|
@ -1,5 +1,5 @@
|
||||
import punycode from "punycode/";
|
||||
import { tldList } from "./tld_list";
|
||||
import { tldList } from "./tldList";
|
||||
|
||||
export default function validLink(link: string) {
|
||||
let finalURL = '';
|
||||
@ -24,7 +24,6 @@ export default function validLink(link: string) {
|
||||
|
||||
function validTLD(domain: string): boolean {
|
||||
const tld = punycode.toUnicode(domain.split(".").reverse()[0]);
|
||||
console.log(tld);
|
||||
if (tldList.includes(tld)) {
|
||||
return true;
|
||||
} else {
|
@ -1,5 +1,5 @@
|
||||
import {describe, expect, test} from '@jest/globals';
|
||||
import validLink from "../lib/url/valid_link";
|
||||
import validLink from "../lib/url/validLink";
|
||||
|
||||
test("Plain, full URL", () => {
|
||||
expect(validLink("https://example.com/about-us")).toBe(true);
|
||||
|
Loading…
Reference in New Issue
Block a user