diff --git a/spec/common/misc/utils.spec.ts b/spec/common/misc/utils.spec.ts index a3bed402..0d163706 100644 --- a/spec/common/misc/utils.spec.ts +++ b/spec/common/misc/utils.spec.ts @@ -64,6 +64,16 @@ describe('Utils Service', () => { expect(Utils.getDomain('https://subdomain.bütwarden.com')).toBe('bütwarden.com'); }); + it('should support punycode urls', () => { + expect(Utils.getDomain('xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + expect(Utils.getDomain('xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + expect(Utils.getDomain('xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + + expect(Utils.getDomain('subdomain.xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + expect(Utils.getDomain('http://subdomain.xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + expect(Utils.getDomain('https://subdomain.xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + }); + it('should support localhost', () => { expect(Utils.getDomain('localhost')).toBe('localhost'); expect(Utils.getDomain('http://localhost')).toBe('localhost'); @@ -146,6 +156,16 @@ describe('Utils Service', () => { expect(Utils.getHostname('https://subdomain.bütwarden.com')).toBe('subdomain.bütwarden.com'); }); + it('should support punycode urls', () => { + expect(Utils.getHostname('xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + expect(Utils.getHostname('xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + expect(Utils.getHostname('xn--btwarden-65a.com')).toBe('xn--btwarden-65a.com'); + + expect(Utils.getHostname('subdomain.xn--btwarden-65a.com')).toBe('subdomain.xn--btwarden-65a.com'); + expect(Utils.getHostname('http://subdomain.xn--btwarden-65a.com')).toBe('subdomain.xn--btwarden-65a.com'); + expect(Utils.getHostname('https://subdomain.xn--btwarden-65a.com')).toBe('subdomain.xn--btwarden-65a.com'); + }); + it('should support localhost', () => { expect(Utils.getHostname('localhost')).toBe('localhost'); expect(Utils.getHostname('http://localhost')).toBe('localhost');