Skip to content

Commit

Permalink
🚦 Setup tests with jest
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardfactory committed Mar 11, 2019
1 parent 86b8de7 commit b35043b
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 2 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"build:lib": "babel src -d lib -x '.ts,.tsx'",
"build:types": "tsc --emitDeclarationOnly",
"check-types": "tsc --noEmit",
"release": "release-it"
"release": "release-it",
"test": "jest",
"test:dev": "jest --watch"
},
"files": [
"/lib"
Expand Down Expand Up @@ -49,9 +51,12 @@
"@babel/preset-env": "^7.3.4",
"@babel/preset-typescript": "^7.3.3",
"@favoloso/conventional-changelog-emoji": "^0.9.0",
"@types/dedent": "^0.7.0",
"@types/jest": "^24.0.11",
"@types/remarkable": "^1.7.2",
"babel-jest": "^24.3.1",
"conventional-changelog-cli": "^2.0.12",
"dedent": "^0.7.0",
"husky": "^1.3.1",
"jest": "^24.3.1",
"release-it": "^10.3.1",
Expand Down
22 changes: 22 additions & 0 deletions src/parser.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Remarkable from 'remarkable';
import { parser } from './parser';
import dedent from 'dedent';

let md!: Remarkable;

describe('remarkable-callout', () => {
beforeEach(() => {
md = new Remarkable();
});

test('should render a callout', () => {
md.use(parser);
expect(
md.render(dedent`
:::info
Info
:::
`)
).toEqual(`<p class="callout-info">Info</p>`);
});
});
5 changes: 5 additions & 0 deletions src/parser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Remarkable from 'remarkable';

export const parser: Remarkable.Plugin = (md, opts) => {
// hello
};
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

"outDir": "lib",
"rootDir": "src",
"baseUrl": "."
"baseUrl": ".",

"paths": {
"*": ["types/*"]
}
},
"include": ["src/**/*", "src/**/*.json"]
}
1 change: 1 addition & 0 deletions types/dedent.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module 'dedent';
22 changes: 22 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,11 @@
dependencies:
"@babel/types" "^7.3.0"

"@types/dedent@^0.7.0":
version "0.7.0"
resolved "https://registry.yarnpkg.com/@types/dedent/-/dedent-0.7.0.tgz#155f339ca404e6dd90b9ce46a3f78fd69ca9b050"
integrity sha512-EGlKlgMhnLt/cM4DbUSafFdrkeJoC9Mvnj0PUCU7tFmTjMjNRT957kXCx0wYm3JuEq4o4ZsS5vG+NlkM2DMd2A==

"@types/events@*":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
Expand All @@ -902,6 +907,18 @@
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.0.tgz#2cc2ca41051498382b43157c8227fea60363f94a"
integrity sha512-ohkhb9LehJy+PA40rDtGAji61NCgdtKLAlFoYp4cnuuQEswwdK3vz9SOIkkyc3wrk8dzjphQApNs56yyXLStaQ==

"@types/jest-diff@*":
version "20.0.1"
resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89"
integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA==

"@types/jest@^24.0.11":
version "24.0.11"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.11.tgz#1f099bea332c228ea6505a88159bfa86a5858340"
integrity sha512-2kLuPC5FDnWIDvaJBzsGTBQaBbnDweznicvK7UGYzlIJP4RJR2a4A/ByLUXEyEgag6jz8eHdlWExGDtH3EYUXQ==
dependencies:
"@types/jest-diff" "*"

"@types/minimatch@*":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
Expand Down Expand Up @@ -1974,6 +1991,11 @@ decompress-response@^3.3.0:
dependencies:
mimic-response "^1.0.0"

dedent@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
integrity sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=

deep-extend@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac"
Expand Down

0 comments on commit b35043b

Please sign in to comment.