UNPKG

1.04 kBJavaScriptView Raw
1/* jshint expr: true */
2/* global describe: false, it: false, before: false */
3'use strict';
4require('should');
5var Stringify = require('../index');
6
7describe('the "stringify" function', function () {
8 before(function () {
9 this.test_string = '<html><head></head><body><h1 class="bananas" title="donkies">' +
10 'This is my test string HTML!</h1></body></html>';
11
12 this.stringified_content = Stringify.stringify(this.test_string);
13 });
14
15 it('should have returned a string', function () {
16 this.stringified_content.should.be.a.String;
17 });
18
19 it('should begin with module.exports = "', function () {
20 this.stringified_content.should.startWith('module.exports = "');
21 });
22
23 // TODO: Figure out how to do a capture-repeat Regex for this to actually ensure all 5 newlines were preserved.
24 it('should have perserved newline characters', function () {
25 this.stringified_content.should.match(/\n/);
26 });
27
28 it('should have escaped the double-quotes', function () {
29 this.stringified_content.should.match(/\\\"/);
30 });
31});