Repositorio del curso CCOM4030 el semestre B91 del proyecto Paz para la Mujer

1234567891011121314151617181920212223242526272829
  1. var test = require('tape');
  2. var escape = require('./index');
  3. test("Characters should be escaped properly", function (t) {
  4. t.plan(1);
  5. t.equals(escape('" \' < > &'), '&quot; &apos; &lt; &gt; &amp;');
  6. })
  7. test("Module should respect ignore string", function (t) {
  8. t.plan(3);
  9. t.equals(escape('" \' < > &', '"'), '" &apos; &lt; &gt; &amp;');
  10. t.equals(escape('" \' < > &', '>&'), '&quot; &apos; &lt; > &');
  11. t.equals(escape('" \' < > &', '"\'<>&'), '" \' < > &');
  12. })
  13. test("Module should not escape random characters", function (t) {
  14. t.plan(1);
  15. t.equals(escape('<[whats up]>', '<]what'), '<[whats up]&gt;');
  16. })
  17. test("Module should not crash on null or undefined input", function (t) {
  18. t.plan(3);
  19. t.equals((escape("")), "");
  20. t.doesNotThrow(function(){escape(null);}, TypeError);
  21. t.doesNotThrow(function(){escape(undefined);}, TypeError);
  22. })