HEX
Server: LiteSpeed
System: Linux d8 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: wbwebdes (3015)
PHP: 8.1.31
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/wbwebdes/domains/survey.nailsbyrianne.nl/public_html/tmp/assets/e2d2bdff/test/uri/colonUri.js
var assert = require('assert')

var Uri = (typeof(require) === 'function') ? require('../../Uri') : window.Uri

describe('Uri', function() {
  describe('ssh url', function() {
    it('should not add slashes when it is colon uri', function (){
      var u = new Uri('ssh://test.com:')
      u.setPath('relativePath')
      assert.equal(u.toString(), 'ssh://test.com:relativePath')
      u.setPath('/relativePath')
      assert.equal(u.toString(), 'ssh://test.com:/relativePath')
    })

    it('understand isColonUti', function (){
      var u = new Uri('ssh://test.com')
      u.isColonUri(true);
      u.setPath('relativePath')
      assert.equal(u.toString(), 'ssh://test.com:relativePath')
    })

    it('can remove and re-add isColonUti', function (){
      var u = new Uri('ssh://test.com:pathtest')
      u.isColonUri(false);
      u.setPath('relativePath')
      assert.equal(u.toString(), 'ssh://test.com/relativePath')
      u.isColonUri(true);
      assert.equal(u.toString(), 'ssh://test.com:relativePath')
    })
  })

  describe('ssh url extended', function() {
    it('keep port unset and numeric path', function (){
      assert.equal(new Uri('me:[email protected]::123/this/is/a/path').toString(), 'me:[email protected]::123/this/is/a/path')
    })

    it('should correctly add port', function (){
      var u = new Uri('test.com:')
      u.setPort(123);
      u.setPath('123this/is/a/path');
      assert.equal(u.toString(), 'test.com:123:123this/is/a/path')
    })

    it('keep port and empty path', function (){
      assert.equal(new Uri('me:[email protected]:12:').toString(), 'me:[email protected]:12')
    })
  })
})