package com.freshworks.freshdesk.reactnative import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test class FreshdeskHostUtilsTest { @Test fun `bare host with no scheme is bare`() { assertTrue(FreshdeskHostUtils.isBareHost("example.freshdesk.com")) } @Test fun `host with http scheme is not bare`() { assertFalse(FreshdeskHostUtils.isBareHost("http://example.freshdesk.com")) } @Test fun `host with https scheme is not bare`() { assertFalse(FreshdeskHostUtils.isBareHost("https://example.freshdesk.com")) } @Test fun `scheme check is case-insensitive`() { assertFalse(FreshdeskHostUtils.isBareHost("HTTPS://example.freshdesk.com")) } @Test fun `blank host is not reported as bare`() { // isBareHost is a diagnostic hint ("did you forget https://"), not a // validity check — a genuinely empty host is a different failure mode // (a missing required config value), so it should not also read as "bare". assertFalse(FreshdeskHostUtils.isBareHost("")) assertFalse(FreshdeskHostUtils.isBareHost(" ")) } @Test fun `surrounding whitespace is trimmed before the scheme check`() { assertFalse(FreshdeskHostUtils.isBareHost(" https://example.freshdesk.com ")) assertTrue(FreshdeskHostUtils.isBareHost(" example.freshdesk.com ")) } }