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: fix redeclared vars in test-url #4993

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
26 changes: 13 additions & 13 deletions test/parallel/test-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,10 +856,10 @@ var parseTests = {

};

for (var u in parseTests) {
var actual = url.parse(u);
var spaced = url.parse(' \t ' + u + '\n\t');
var expected = parseTests[u];
for (const u in parseTests) {
let actual = url.parse(u);
const spaced = url.parse(' \t ' + u + '\n\t');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit: template string?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, why not?

let expected = parseTests[u];

Object.keys(actual).forEach(function(i) {
if (expected[i] === undefined && actual[i] === null) {
Expand Down Expand Up @@ -928,10 +928,10 @@ var parseTestsWithQueryString = {
href: '/example?query=value'
}
};
for (var u in parseTestsWithQueryString) {
var actual = url.parse(u, true);
var expected = parseTestsWithQueryString[u];
for (var i in actual) {
for (const u in parseTestsWithQueryString) {
const actual = url.parse(u, true);
const expected = parseTestsWithQueryString[u];
for (const i in actual) {
if (actual[i] === null && expected[i] === undefined) {
expected[i] = null;
}
Expand Down Expand Up @@ -1130,11 +1130,11 @@ var formatTests = {
pathname: '/fooA100%mBr',
}
};
for (var u in formatTests) {
var expect = formatTests[u].href;
for (const u in formatTests) {
const expect = formatTests[u].href;
delete formatTests[u].href;
var actual = url.format(u);
var actualObj = url.format(formatTests[u]);
const actual = url.format(u);
const actualObj = url.format(formatTests[u]);
assert.equal(actual, expect,
'wonky format(' + u + ') == ' + expect +
'\nactual:' + actual);
Expand Down Expand Up @@ -1567,7 +1567,7 @@ var throws = [
0,
function() {}
];
for (var i = 0; i < throws.length; i++) {
for (let i = 0; i < throws.length; i++) {
assert.throws(function() { url.format(throws[i]); }, TypeError);
}
assert(url.format('') === '');
Expand Down