test.js 584 B

12345678910111213141516171819202122
  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. });