add tests

This commit is contained in:
Tony Brix 2018-03-04 00:47:02 -06:00
parent dce66a2849
commit 79325aa9e1
4 changed files with 25 additions and 4 deletions

View File

@ -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",

View 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
View 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();
}
});

View File

@ -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();
});