Skip to content

Commit

Permalink
move to unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed May 2, 2018
1 parent cc35600 commit 484deb5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
13 changes: 1 addition & 12 deletions test/specs/original/specs-spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var marked = require('../../../lib/marked.js');
var specTests = require('../../index.js');
var specTests = require('../../');

it('should run spec tests', function () {
// hide output
Expand All @@ -11,13 +10,3 @@ it('should run spec tests', function () {
fail();
}
});

it('should use the correct paragraph type', function () {
const md = 'A Paragraph.\n\n> A blockquote\n\n- list item\n';

const tokens = marked.lexer(md);

expect(tokens[0].type).toBe('paragraph');
expect(tokens[3].type).toBe('paragraph');
expect(tokens[7].type).toBe('text');
});
18 changes: 12 additions & 6 deletions test/unit/marked-spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
var marked = require('../../lib/marked.js');

it('should run the test', function () {
spyOn(marked, 'parse').and.callThrough();
marked.parse('Hello World!');
expect(marked.parse).toHaveBeenCalled();
});

describe('Test heading ID functionality', function() {
it('should add id attribute by default', function() {
var renderer = new marked.Renderer(marked.defaults);
Expand All @@ -19,3 +13,15 @@ describe('Test heading ID functionality', function() {
expect(header).toBe('<h1>test</h1>\n');
});
});

describe('Test paragraph token type', function () {
it('should use the "paragraph" type on top level', function () {
const md = 'A Paragraph.\n\n> A blockquote\n\n- list item\n';

const tokens = marked.lexer(md);

expect(tokens[0].type).toBe('paragraph');
expect(tokens[3].type).toBe('paragraph');
expect(tokens[7].type).toBe('text');
});
});

0 comments on commit 484deb5

Please sign in to comment.