1'use strict'; 2 3// Tests below are not from WPT. 4 5require('../common'); 6const assert = require('assert'); 7const URLSearchParams = require('url').URLSearchParams; 8 9{ 10 const params = new URLSearchParams(); 11 assert.throws(() => { 12 params.getAll.call(undefined); 13 }, { 14 code: 'ERR_INVALID_THIS', 15 name: 'TypeError', 16 message: 'Value of "this" must be of type URLSearchParams' 17 }); 18 assert.throws(() => { 19 params.getAll(); 20 }, { 21 code: 'ERR_MISSING_ARGS', 22 name: 'TypeError', 23 message: 'The "name" argument must be specified' 24 }); 25 26 const obj = { 27 toString() { throw new Error('toString'); }, 28 valueOf() { throw new Error('valueOf'); } 29 }; 30 const sym = Symbol(); 31 assert.throws(() => params.getAll(obj), /^Error: toString$/); 32 assert.throws(() => params.getAll(sym), 33 /^TypeError: Cannot convert a Symbol value to a string$/); 34} 35