add tests
This commit is contained in:
parent
dce66a2849
commit
79325aa9e1
@ -38,9 +38,11 @@
|
|||||||
"uglify-js": "^3.3.10"
|
"uglify-js": "^3.3.10"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npm run test:unit && npm run test:spec",
|
"test": "jasmine --config=jasmine.json",
|
||||||
"test:unit": "jasmine --config=jasmine.json",
|
"test:unit": "npm test -- test/unit/**/*-spec.js",
|
||||||
"test:spec": "node test",
|
"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",
|
"test:lint": "eslint lib/marked.js test/index.js",
|
||||||
"bench": "node test --bench",
|
"bench": "node test --bench",
|
||||||
"lint": "eslint --fix lib/marked.js test/index.js",
|
"lint": "eslint --fix lib/marked.js test/index.js",
|
||||||
|
5
test/integration/marked-spec.js
Normal file
5
test/integration/marked-spec.js
Normal file
@ -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
test/specs/specs-spec.js
Normal file
12
test/specs/specs-spec.js
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
});
|
@ -1,5 +1,7 @@
|
|||||||
var marked = require('../../lib/marked.js');
|
var marked = require('../../lib/marked.js');
|
||||||
|
|
||||||
it('should run the test', function () {
|
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();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user