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