Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

child_ordering.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. var test = require('../');
  2. var childRan = false;
  3. test('parent', function (t) {
  4. t.test('child', function (t) {
  5. childRan = true;
  6. t.pass('child ran');
  7. t.end();
  8. });
  9. t.end();
  10. });
  11. test('uncle', function (t) {
  12. t.ok(childRan, 'Child should run before next top-level test');
  13. t.end();
  14. });
  15. var grandParentRan = false;
  16. var parentRan = false;
  17. var grandChildRan = false;
  18. test('grandparent', function (t) {
  19. t.ok(!grandParentRan, 'grand parent ran twice');
  20. grandParentRan = true;
  21. t.test('parent', function (t) {
  22. t.ok(!parentRan, 'parent ran twice');
  23. parentRan = true;
  24. t.test('grandchild', function (t) {
  25. t.ok(!grandChildRan, 'grand child ran twice');
  26. grandChildRan = true;
  27. t.pass('grand child ran');
  28. t.end();
  29. });
  30. t.pass('parent ran');
  31. t.end();
  32. });
  33. t.test('other parent', function (t) {
  34. t.ok(parentRan, 'first parent runs before second parent');
  35. t.ok(grandChildRan, 'grandchild runs before second parent');
  36. t.end();
  37. });
  38. t.pass('grandparent ran');
  39. t.end();
  40. });
  41. test('second grandparent', function (t) {
  42. t.ok(grandParentRan, 'grandparent ran');
  43. t.ok(parentRan, 'parent ran');
  44. t.ok(grandChildRan, 'grandchild ran');
  45. t.pass('other grandparent ran');
  46. t.end();
  47. });
  48. // vim: set softtabstop=4 shiftwidth=4: