mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
test: improve test coverage (#6387)
* test: improve test coverage * fix * use posixPath
This commit is contained in:
parent
a9810db1cc
commit
62223ee556
24 changed files with 463 additions and 60 deletions
|
@ -5,7 +5,24 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import {parseBlogFileName} from '../blogUtils';
|
||||
import {truncate, parseBlogFileName} from '../blogUtils';
|
||||
|
||||
describe('truncate', () => {
|
||||
test('truncates texts', () => {
|
||||
expect(
|
||||
truncate('aaa\n<!-- truncate -->\nbbb\nccc', /<!-- truncate -->/),
|
||||
).toEqual('aaa\n');
|
||||
expect(
|
||||
truncate('\n<!-- truncate -->\nbbb\nccc', /<!-- truncate -->/),
|
||||
).toEqual('\n');
|
||||
});
|
||||
test('leaves texts without markers', () => {
|
||||
expect(truncate('aaa\nbbb\nccc', /<!-- truncate -->/)).toEqual(
|
||||
'aaa\nbbb\nccc',
|
||||
);
|
||||
expect(truncate('', /<!-- truncate -->/)).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseBlogFileName', () => {
|
||||
test('parse file', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue