Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/test_jim.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

module('injection');
test('protocol', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
raises(function() {
u.protocol('ftp://example.org');
}, TypeError, 'Failing invalid characters');
Expand All @@ -21,7 +21,7 @@
equal(u.hostname(), 'example.com', 'protocol() has changed the hostname');
});
test('port', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
raises(function() {
u.port('99:example.org');
}, TypeError, 'Failing invalid characters');
Expand All @@ -43,7 +43,7 @@
}, TypeError, 'Failing invalid characters');
});
test('domain', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');

raises(function() {
u.domain('example.org/dir0/');
Expand All @@ -58,7 +58,7 @@
}, TypeError, 'Failing invalid characters');
});
test('subdomain', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');

raises(function() {
u.subdomain('example.org/dir0/');
Expand All @@ -73,22 +73,22 @@
}, TypeError, 'Failing invalid characters');
});
test('tld', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');

raises(function() {
u.tld('foo/bar.html');
}, TypeError, 'Failing invalid characters');
});
test('path', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
u.path('/dir3/?query3=value3#fragment');
equal(u.hostname(), 'example.com', 'path() has modified hostname');
equal(u.path(), '/dir3/%3Fquery3=value3%23fragment', 'path() has set invalid path');
equal(u.query(), 'query1=value1&query2=value2', 'path() has modified query');
equal(u.fragment(), 'hash', 'path() has modified fragment');
});
test('filename', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');

u.filename('name.html?query');
equal(u.filename(), 'name.html%3Fquery', 'filename() has set invalid filename');
Expand All @@ -112,7 +112,7 @@
equal(u.directory(), '/dir1', 'filename() has not altered directory properly');
});
test('addQuery', function() {
var u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
let u = new URI('http://example.com/dir1/dir2/?query1=value1&query2=value2#hash');
u.addQuery('query3', 'value3#got');
equal(u.query(), 'query1=value1&query2=value2&query3=value3%23got', 'addQuery() has set invalid query');
equal(u.fragment(), 'hash', 'addQuery() has modified fragment');
Expand Down