mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 01:32:47 +00:00
Initial commit with jest enabling
Removed dependency on pico-check and existing tests. Added jest as dev dependency, introduced minimal configuration for it. Added a very first couple of tests for our markdown parser/renderer.
This commit is contained in:
13
package.json
13
package.json
@@ -18,8 +18,8 @@
|
|||||||
"lint:dry": "eslint **/*.{js,jsx}",
|
"lint:dry": "eslint **/*.{js,jsx}",
|
||||||
"circleci": "npm test && eslint **/*.{js,jsx} --max-warnings=0",
|
"circleci": "npm test && eslint **/*.{js,jsx} --max-warnings=0",
|
||||||
"verify": "npm run lint && npm test",
|
"verify": "npm run lint && npm test",
|
||||||
"test": "pico-check",
|
"test": "jest",
|
||||||
"test:dev": "pico-check -v -w",
|
"test:dev": "jest --verbose --watch",
|
||||||
"phb": "node scripts/phb.js",
|
"phb": "node scripts/phb.js",
|
||||||
"prod": "set NODE_ENV=production && npm run build",
|
"prod": "set NODE_ENV=production && npm run build",
|
||||||
"postinstall": "npm run buildall",
|
"postinstall": "npm run buildall",
|
||||||
@@ -30,8 +30,11 @@
|
|||||||
"eslintIgnore": [
|
"eslintIgnore": [
|
||||||
"build/*"
|
"build/*"
|
||||||
],
|
],
|
||||||
"pico-check": {
|
"jest": {
|
||||||
"require": "./tests/test.init.js"
|
"modulePaths": [
|
||||||
|
"mode_modules",
|
||||||
|
"shared"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": [
|
"presets": [
|
||||||
@@ -79,6 +82,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.5.0",
|
"eslint": "^8.5.0",
|
||||||
"eslint-plugin-react": "^7.28.0",
|
"eslint-plugin-react": "^7.28.0",
|
||||||
"pico-check": "^2.2.0"
|
"jest": "^27.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
const test = require('pico-check');
|
|
||||||
|
|
||||||
test('Just setting up a spot for future tests', (t)=>{
|
|
||||||
t.pass();
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = test;
|
|
||||||
13
tests/markdown.test.js
Normal file
13
tests/markdown.test.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const Markdown = require('naturalcrit/markdown.js');
|
||||||
|
|
||||||
|
test('Escapes <script> tag', function() {
|
||||||
|
const source = '<script></script>';
|
||||||
|
const rendered = Markdown.render(source);
|
||||||
|
expect(rendered).toMatch('<script></script>');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Processes the markdown within an HTML block if its just a class wrapper', function() {
|
||||||
|
const source = '<div>*Bold text*</div>';
|
||||||
|
const rendered = Markdown.render(source);
|
||||||
|
expect(rendered).toBe('<div> <p><em>Bold text</em></p>\n </div>');
|
||||||
|
});
|
||||||
@@ -1 +0,0 @@
|
|||||||
//Set up configs and DB connectiosna nd what not in here
|
|
||||||
Reference in New Issue
Block a user