array-test.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. (function() {
  2. var assert, vows, util;
  3. vows = require('vows');
  4. assert = require('assert');
  5. util = require('../../lib/util');
  6. vows.describe('Module core extension Array').addBatch({
  7. 'Testing del': {
  8. topic: ['a', 'b', 'c'],
  9. 'element exists': {
  10. 'first element': function(topic) {
  11. return assert.deepEqual(util.array.del(topic, 'a'), ['b', 'c']);
  12. },
  13. 'middle element': function(topic) {
  14. return assert.deepEqual(util.array.del(topic, 'b'), ['a', 'c']);
  15. },
  16. 'last element': function(topic) {
  17. return assert.deepEqual(util.array.del(topic, 'c'), ['a', 'b']);
  18. }
  19. },
  20. 'element does not exist': function(topic) {
  21. return assert.deepEqual(util.array.del(topic, 'd'), ['a', 'b', 'c']);
  22. }
  23. },
  24. 'Testing utils': {
  25. topic: ['a', 'b', 'c'],
  26. 'first': function(topic) {
  27. return assert.equal(util.array.first(topic), 'a');
  28. },
  29. 'last': function(topic) {
  30. return assert.equal(util.array.last(topic), 'c');
  31. }
  32. }
  33. })["export"](module);
  34. }).call(this);