-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] Test that
Url#set()
correctly handles the auth
property
Test that when the value of the `auth` property is updated, the values of the `username` and `password` properties are also updated. Refs: #213
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1046,6 +1046,30 @@ describe('url-parse', function () { | |
assume(data.href).equals('mailto:[email protected]'); | ||
}); | ||
|
||
it('updates username and password when updating auth', function() { | ||
var data = parse('https://example.com'); | ||
|
||
assume(data.set('auth', 'foo:bar')).equals(data); | ||
assume(data.username).equals('foo'); | ||
assume(data.password).equals('bar'); | ||
assume(data.href).equals('https://foo:[email protected]/'); | ||
|
||
assume(data.set('auth', 'baz:')).equals(data); | ||
assume(data.username).equals('baz'); | ||
assume(data.password).equals(''); | ||
assume(data.href).equals('https://[email protected]/'); | ||
|
||
assume(data.set('auth', 'qux')).equals(data); | ||
assume(data.username).equals('qux'); | ||
assume(data.password).equals(''); | ||
assume(data.href).equals('https://[email protected]/'); | ||
|
||
assume(data.set('auth', ':quux')).equals(data); | ||
assume(data.username).equals(''); | ||
assume(data.password).equals('quux'); | ||
assume(data.href).equals('https://:[email protected]/'); | ||
}); | ||
|
||
it('updates other values', function () { | ||
var data = parse('http://google.com/?foo=bar'); | ||
|
||
|