You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
584 B

4 years ago
  1. var uniqs = require('./');
  2. var util = require('util');
  3. var assert = require('assert');
  4. var foo = { foo: 23 };
  5. [
  6. [ [[2, 1, 1], [2, 3, 3, 4], [4, 3, 2]], [2, 1, 3, 4] ],
  7. [ [3, 2, 2, [1, 1, 2]], [3, 2, 1] ],
  8. [ [[2, 2, 3, "a", 3, 1, foo, foo, "a" ]], [ 2, 3, "a", 1, foo ] ],
  9. [ [23], [23] ],
  10. [ [], [] ],
  11. [ [[]], [] ],
  12. [ [[null], null], [null] ]
  13. ]
  14. .forEach(function(t) {
  15. var args = t[0].map(JSON.stringify);
  16. assert.deepEqual(uniqs.apply(this, t[0]), t[1],
  17. util.format('✘ uniqs(%s) !== %j', args, t[1])
  18. );
  19. console.log('✔ uniqs(%s) == %j', args, t[1]);
  20. });