mirror of
https://github.com/bitwarden/jslib
synced 2025-12-26 21:23:53 +00:00
Added testcases for punycode urls
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user