File: esnext.set.join.js

package info (click to toggle)
node-core-js 3.33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 18,828 kB
  • sloc: javascript: 87,204; makefile: 13
file content (20 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* eslint-disable unicorn/require-array-join-separator -- required for testing */
QUnit.test('Set#join', assert => {
  const { join } = Set.prototype;

  assert.isFunction(join);
  assert.arity(join, 1);
  assert.name(join, 'join');
  assert.looksNative(join);
  assert.nonEnumerable(Set.prototype, 'join');

  assert.same(new Set([1, 2, 3]).join(), '1,2,3');
  assert.same(new Set([1, 2, 3]).join(undefined), '1,2,3');
  assert.same(new Set([1, 2, 3]).join('|'), '1|2|3');

  assert.throws(() => join.call(new Map()), TypeError);
  assert.throws(() => join.call({}), TypeError);
  assert.throws(() => join.call([]), TypeError);
  assert.throws(() => join.call(undefined), TypeError);
  assert.throws(() => join.call(null), TypeError);
});