aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-whatwg-url-origin-for.js
blob: 9e015f805101482f867b8a251d148c362f8851c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';

const common = require('../common');

const originFor = require('url').originFor;
const path = require('path');
const assert = require('assert');
const tests = require(path.join(common.fixturesDir, 'url-tests.json'));

for (const test of tests) {
  if (typeof test === 'string')
    continue;

  if (test.origin) {
    const origin = originFor(test.input, test.base);
    // Pass true to origin.toString() to enable unicode serialization.
    assert.strictEqual(origin.toString(true), test.origin);
  }
}