UNPKG

dorm-node

Version:

Library for creating and managing arbitrary object models and their relationships, and the data used by those models.

49 lines (38 loc) 1.11 kB
var should = require('chai').should(), scapegoat = require('../index'), escape = scapegoat.escape, unescape = scapegoat.unescape; describe('#escape', function() { it('converts & into &amp;', function() { escape('&').should.equal('&amp;'); }); it('converts " into &quot;', function() { escape('"').should.equal('&quot;'); }); it('converts ' into &#39;', function() { escape(''').should.equal('&#39;'); }); it('converts < into &lt;', function() { escape('<').should.equal('&lt;'); }); it('converts > into &gt;', function() { escape('>').should.equal('&gt;'); }); }); describe('#unescape', function() { it('converts &amp; into &', function() { unescape('&amp;').should.equal('&'); }); it('converts &quot; into "', function() { unescape('&quot;').should.equal('"'); }); it('converts &#39; into '', function() { unescape('&#39;').should.equal('''); }); it('converts &lt; into <', function() { unescape('&lt;').should.equal('<'); }); it('converts &gt; into >', function() { unescape('&gt;').should.equal('>'); }); });