-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(script): add jest for scripts package (#148)
* test(scripts): add jest for scripts package * chore: update jest config * chore(ci): run test on CI * chore(ci): run test after setup job
- Loading branch information
1 parent
ce0a2e3
commit 94d1c92
Showing
8 changed files
with
109 additions
and
15 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
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,8 @@ | ||
import type { Config } from '@jest/types'; | ||
|
||
const config: Config.InitialOptions = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
}; | ||
|
||
export default config; |
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 { getMarkdownSection } from '../common'; | ||
|
||
describe('getMarkdownSection', () => { | ||
it('gets the section correctly', () => { | ||
const text = ` | ||
# hello | ||
hi | ||
# world | ||
hey | ||
`; | ||
expect(getMarkdownSection(text, '# hello')).toMatchInlineSnapshot(` | ||
"# hello | ||
hi | ||
" | ||
`); | ||
}); | ||
|
||
it('gets the sub headings', () => { | ||
const text = ` | ||
# hi | ||
# hello | ||
## sub-heading | ||
hello | ||
# this shouldn't be included | ||
right? | ||
`; | ||
|
||
expect(getMarkdownSection(text, '# hello')).toMatchInlineSnapshot(` | ||
"# hello | ||
## sub-heading | ||
hello | ||
" | ||
`); | ||
}); | ||
|
||
it('gets the whole text till the end', () => { | ||
const text = ` | ||
# hi | ||
# hello | ||
this is a test | ||
`; | ||
|
||
expect(getMarkdownSection(text, '# hello')).toMatchInlineSnapshot(` | ||
"# hello | ||
this is a 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
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