mirror of
https://github.com/bitwarden/jslib
synced 2025-12-20 18:23:52 +00:00
Added tests to verify handling of localhost with subdomain
This commit is contained in:
@@ -58,7 +58,12 @@ describe('Utils Service', () => {
|
|||||||
expect(Utils.getDomain('localhost')).toBe('localhost');
|
expect(Utils.getDomain('localhost')).toBe('localhost');
|
||||||
expect(Utils.getDomain('http://localhost')).toBe('localhost');
|
expect(Utils.getDomain('http://localhost')).toBe('localhost');
|
||||||
expect(Utils.getDomain('https://localhost')).toBe('localhost');
|
expect(Utils.getDomain('https://localhost')).toBe('localhost');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should support localhost with subdomain', () => {
|
||||||
|
expect(Utils.getDomain('subdomain.localhost')).toBe('localhost');
|
||||||
|
expect(Utils.getDomain('http://subdomain.localhost')).toBe('localhost');
|
||||||
|
expect(Utils.getDomain('https://subdomain.localhost')).toBe('localhost');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support IPv4', () => {
|
it('should support IPv4', () => {
|
||||||
@@ -127,6 +132,12 @@ describe('Utils Service', () => {
|
|||||||
expect(Utils.getHostname('https://localhost')).toBe('localhost');
|
expect(Utils.getHostname('https://localhost')).toBe('localhost');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should support localhost with subdomain', () => {
|
||||||
|
expect(Utils.getHostname('subdomain.localhost')).toBe('subdomain.localhost');
|
||||||
|
expect(Utils.getHostname('http://subdomain.localhost')).toBe('subdomain.localhost');
|
||||||
|
expect(Utils.getHostname('https://subdomain.localhost')).toBe('subdomain.localhost');
|
||||||
|
});
|
||||||
|
|
||||||
it('should support IPv4', () => {
|
it('should support IPv4', () => {
|
||||||
expect(Utils.getHostname('192.168.1.1')).toBe('192.168.1.1');
|
expect(Utils.getHostname('192.168.1.1')).toBe('192.168.1.1');
|
||||||
expect(Utils.getHostname('http://192.168.1.1')).toBe('192.168.1.1');
|
expect(Utils.getHostname('http://192.168.1.1')).toBe('192.168.1.1');
|
||||||
|
|||||||
Reference in New Issue
Block a user