Skip to main content
Module

x/ramda/test/union.js

:ram: Practical functional Javascript
Latest
File
var R = require('../source');var eq = require('./shared/eq');

describe('union', function() { var M = [1, 2, 3, 4]; var N = [3, 4, 5, 6]; it('combines two lists into the set of all their elements', function() { eq(R.union(M, N), [1, 2, 3, 4, 5, 6]); });
it('has R.equals semantics', function() { function Just(x) { this.value = x; } Just.prototype.equals = function(x) { return x instanceof Just && R.equals(x.value, this.value); };
eq(R.union([0], [-0]).length, 2); eq(R.union([-0], [0]).length, 2); eq(R.union([NaN], [NaN]).length, 1); eq(R.union([new Just([42])], [new Just([42])]).length, 1); });
});