-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70f4d98
commit b5bc742
Showing
11 changed files
with
2,706 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
], | ||
"@babel/preset-typescript" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/node_modules | ||
/dist | ||
/build | ||
/public | ||
/public | ||
/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Runs all the tests | ||
name: Test Pull Requests | ||
|
||
on: | ||
pull_request: | ||
branches: [ ] | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
name: Run tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Run tests | ||
run: yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/dist | ||
/public | ||
/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
testEnvironment: "node", //deafult is jsdom i.e test envrionment | ||
testRegex: "/tests/.*\\.(test|spec)?\\.(ts)$", //under test folder, file names should be tests/newTest.test(spec).ts | ||
moduleFileExtensions: ["ts", "js", "json", "node"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
Markdown, | ||
ParsedMarkdown, | ||
parseMarkdownWithoutWrapper, | ||
} from "../src/index"; | ||
|
||
describe("parser behaviour over different markdown commands", () => { | ||
describe("parse headings", () => { | ||
it("should parse h1", () => { | ||
const markdown: Markdown = "#h1"; | ||
const expectedParsedMarkdown: Markdown = `<h1>h1</h1>`; | ||
|
||
expect(parseMarkdownWithoutWrapper(markdown)).toEqual( | ||
expectedParsedMarkdown, | ||
); | ||
}); | ||
|
||
it("should parse h2", () => { | ||
const markdown: Markdown = "##h2"; | ||
const expectedParsedMarkdown: Markdown = `<h2>h2</h2>`; | ||
|
||
expect(parseMarkdownWithoutWrapper(markdown)).toEqual( | ||
expectedParsedMarkdown, | ||
); | ||
}); | ||
|
||
it("should parse h3", () => { | ||
const markdown: Markdown = "###h3"; | ||
const expectedParsedMarkdown: Markdown = `<h3>h3</h3>`; | ||
|
||
expect(parseMarkdownWithoutWrapper(markdown)).toEqual( | ||
expectedParsedMarkdown, | ||
); | ||
}); | ||
|
||
it("should parse h4", () => { | ||
const markdown: Markdown = "####h4"; | ||
const expectedParsedMarkdown: Markdown = `<h4>h4</h4>`; | ||
|
||
expect(parseMarkdownWithoutWrapper(markdown)).toEqual( | ||
expectedParsedMarkdown, | ||
); | ||
}); | ||
|
||
it("should parse h5", () => { | ||
const markdown: Markdown = "#####h5"; | ||
const expectedParsedMarkdown: Markdown = `<h5>h5</h5>`; | ||
|
||
expect(parseMarkdownWithoutWrapper(markdown)).toEqual( | ||
expectedParsedMarkdown, | ||
); | ||
}); | ||
|
||
it("should parse h6", () => { | ||
const markdown: Markdown = "######h6"; | ||
const expectedParsedMarkdown: Markdown = `<h6>h6</h6>`; | ||
|
||
expect(parseMarkdownWithoutWrapper(markdown)).toEqual( | ||
expectedParsedMarkdown, | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,9 @@ | |
"strict": true, | ||
}, | ||
"exclude": [ | ||
"./node_modules" | ||
"./node_modules", | ||
"tests", | ||
"**/*.spec.ts", | ||
"**/*.test.ts" | ||
] | ||
} |
Oops, something went wrong.