mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-11-13 17:25:34 +01:00
Add tests for hostname validation
This commit is contained in:
parent
7ceccd5222
commit
7ec1c46a63
|
@ -1,16 +1,17 @@
|
|||
/*
|
||||
* Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/)
|
||||
* Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
||||
*
|
||||
* This is free software, licensed under the GNU General Public License v3.
|
||||
* See /LICENSE for more information.
|
||||
*/
|
||||
|
||||
import {
|
||||
validateDomain,
|
||||
validateDUID,
|
||||
validateIPv4Address,
|
||||
validateIPv6Address,
|
||||
validateIPv6Prefix,
|
||||
validateDomain,
|
||||
validateHostname,
|
||||
validateDUID,
|
||||
validateMAC,
|
||||
} from "utils/validations";
|
||||
|
||||
|
@ -68,6 +69,15 @@ describe("Validation functions", () => {
|
|||
expect(validateDomain(".")).not.toBe(undefined);
|
||||
});
|
||||
|
||||
it("validateHostname valid", () => {
|
||||
expect(validateHostname("new-android")).toBe(undefined);
|
||||
expect(validateHostname("local")).toBe(undefined);
|
||||
});
|
||||
it("validateHostname invalid", () => {
|
||||
expect(validateHostname("-android")).not.toBe(undefined);
|
||||
expect(validateHostname("local.")).not.toBe(undefined);
|
||||
});
|
||||
|
||||
it("validateDUID valid", () => {
|
||||
expect(validateDUID("abcdefAB")).toBe(undefined);
|
||||
expect(validateDUID("ABCDEF12")).toBe(undefined);
|
||||
|
|
Loading…
Reference in New Issue
Block a user