Skip to content

Commit

Permalink
Adding in more test cases for invalid data.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmassaioli committed Jan 10, 2019
1 parent 0651c33 commit eee3c0b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/matter.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@ describe('gray-matter', function() {
assert.equal(actual.orig.toString(), fixture);
});

it('should throw parsing errors', function() {
it('extra characters should throw parsing errors', function() {
assert.throws(function() {
matter('---whatever\nabc: xyz\n---');
});
});

it('boolean yaml types should still return the empty object', function() {
var actual = matter('--- true\n---');
assert.deepEqual(actual.data, {});
});

it('string yaml types should still return the empty object', function() {
var actual = matter('--- true\n---');
assert.deepEqual(actual.data, {});
});

it('number yaml types should still return the empty object', function() {
var actual = matter('--- 42\n---');
assert.deepEqual(actual.data, {});
});

it('should throw an error when a string is not passed:', function() {
assert.throws(function() {
matter();
Expand Down

0 comments on commit eee3c0b

Please sign in to comment.