Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add tests for #54 #57

Merged
merged 1 commit into from
May 13, 2020
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@
if (url.origin !== 'https://www.example.com') throw new Error('Origin value is not correct ' + url.origin);
if (url2.origin !== 'http://www.example.com:8080') throw new Error('Origin value is not correct ' + url2.origin);
if (url3.origin !== 'https://www.example.com:80') throw new Error('Origin value is not correct ' + url3.origin);
`);
});
await tester.test('URL constructor should throw on invalid URL', () => {
return driver.executeScript(`
try {
var url = 'relative_url_without_base';
new URL(url);
throw new Error('Should have thrown for URL(' + url + ')');
} catch (e) {
if (!e instanceof TypeError) {
throw new Error("Expected TypeError but got " + e);
}
}
`);
});
});
Expand Down
14 changes: 14 additions & 0 deletions tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ import { Tester } from './classes/Tester';
`);
});

await tester.test('URL constructor should throw on invalid URL', () => {
return driver.executeScript(`
try {
var url = 'relative_url_without_base';
new URL(url);
throw new Error('Should have thrown for URL(' + url + ')');
} catch (e) {
if (!e instanceof TypeError) {
throw new Error("Expected TypeError but got " + e);
}
}
`);
});

});

})().catch(_ => console.log('ERROR: ', _));