Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
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.

37 lines
772 B

  1. var test = require('tape');
  2. var traverse = require('../');
  3. test('dateEach', function (t) {
  4. var obj = { x : new Date, y : 10, z : 5 };
  5. var counts = {};
  6. traverse(obj).forEach(function (node) {
  7. var t = (node instanceof Date && 'Date') || typeof node;
  8. counts[t] = (counts[t] || 0) + 1;
  9. });
  10. t.same(counts, {
  11. object : 1,
  12. Date : 1,
  13. number : 2,
  14. });
  15. t.end();
  16. });
  17. test('dateMap', function (t) {
  18. var obj = { x : new Date, y : 10, z : 5 };
  19. var res = traverse(obj).map(function (node) {
  20. if (typeof node === 'number') this.update(node + 100);
  21. });
  22. t.ok(obj.x !== res.x);
  23. t.same(res, {
  24. x : obj.x,
  25. y : 110,
  26. z : 105,
  27. });
  28. t.end();
  29. });