Repositorio del curso CCOM4030 el semestre B91 del proyecto kilometro0

not-equal-failure.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. var tape = require('../');
  2. var tap = require('tap');
  3. var concat = require('concat-stream');
  4. var tapParser = require('tap-parser');
  5. var common = require('./common');
  6. var getDiag = common.getDiag;
  7. var stripFullStack = common.stripFullStack;
  8. tap.test('not equal failure', function (assert) {
  9. var test = tape.createHarness({ exit : false });
  10. var stream = test.createStream();
  11. var parser = tapParser();
  12. assert.plan(3);
  13. stream.pipe(parser);
  14. stream.pipe(concat(function (body) {
  15. assert.equal(
  16. stripFullStack(body.toString('utf8')),
  17. 'TAP version 13\n'
  18. + '# not equal\n'
  19. + 'not ok 1 should not be equal\n'
  20. + ' ---\n'
  21. + ' operator: notEqual\n'
  22. + ' expected: 2\n'
  23. + ' actual: 2\n'
  24. + ' at: Test.<anonymous> ($TEST/not-equal-failure.js:$LINE:$COL)\n'
  25. + ' stack: |-\n'
  26. + ' Error: should not be equal\n'
  27. + ' [... stack stripped ...]\n'
  28. + ' at Test.<anonymous> ($TEST/not-equal-failure.js:$LINE:$COL)\n'
  29. + ' [... stack stripped ...]\n'
  30. + ' ...\n'
  31. + '\n'
  32. + '1..1\n'
  33. + '# tests 1\n'
  34. + '# pass 0\n'
  35. + '# fail 1\n'
  36. );
  37. assert.deepEqual(getDiag(body), {
  38. operator: 'notEqual',
  39. expected: '2',
  40. actual: '2'
  41. });
  42. }));
  43. parser.once('assert', function (data) {
  44. delete data.diag.stack;
  45. delete data.diag.at;
  46. assert.deepEqual(data, {
  47. ok: false,
  48. id: 1,
  49. name: 'should not be equal',
  50. diag: {
  51. operator: 'notEqual',
  52. expected: '2',
  53. actual: '2'
  54. }
  55. });
  56. });
  57. test("not equal", function (t) {
  58. t.plan(1);
  59. t.notEqual(2, 2);
  60. });
  61. });