You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

24 lines
670 B

'use strict';
const common = require('../common');
const path = require('path');
const URL = require('url').URL;
const assert = require('assert');
const attrs = require(path.join(common.fixturesDir, 'url-setter-tests.json'));
for (const attr in attrs) {
if (attr === 'comment')
continue;
const tests = attrs[attr];
var n = 0;
for (const test of tests) {
if (test.skip) continue;
n++;
const url = new URL(test.href);
url[attr] = test.new_value;
for (const test_attr in test.expected) {
assert.equal(test.expected[test_attr], url[test_attr],
`${n} ${attr} ${test_attr} ${test.href} ${test.comment}`);
}
}
}