Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Mar 4, 2018
1 parent dce66a2 commit 79325aa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
8 changes: 5 additions & 3 deletions package.json
Expand Up @@ -38,9 +38,11 @@
"uglify-js": "^3.3.10"
},
"scripts": {
"test": "npm run test:unit && npm run test:spec",
"test:unit": "jasmine --config=jasmine.json",
"test:spec": "node test",
"test": "jasmine --config=jasmine.json",
"test:unit": "npm test -- test/unit/**/*-spec.js",
"test:specs": "npm test -- test/specs/**/*-spec.js",
"test:integration": "npm test -- test/integration/**/*-spec.js",
"test:old": "node test",
"test:lint": "eslint lib/marked.js test/index.js",
"bench": "node test --bench",
"lint": "eslint --fix lib/marked.js test/index.js",
Expand Down
5 changes: 5 additions & 0 deletions test/integration/marked-spec.js
@@ -0,0 +1,5 @@
var marked = require('../../marked.min.js');

it('should run the test', function () {
expect(marked('Hello World!')).toBe('<p>Hello World!</p>\n');
});
12 changes: 12 additions & 0 deletions test/specs/specs-spec.js
@@ -0,0 +1,12 @@
var tests = require('../');

it('should run spec tests', function () {
// hide output
spyOn(console, 'log');
if (!tests.runTests({stop: true})) {
// if tests fail rerun tests and show output
console.log.and.callThrough();
tests.runTests();
fail();
}
});
4 changes: 3 additions & 1 deletion test/unit/marked-spec.js
@@ -1,5 +1,7 @@
var marked = require('../../lib/marked.js');

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

0 comments on commit 79325aa

Please sign in to comment.