-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(v2): ability to test the migration cli easily (#3113)
* ability to test the migration cli easily * add node scripts to help test migration cli (locally + CI) * add test for frontmatter quotify * more tests for shouldQuotifyFrontMatter * typo * updated yarn lock
- Loading branch information
Showing
7 changed files
with
69 additions
and
20 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
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
27 changes: 27 additions & 0 deletions
27
packages/docusaurus-migrate/src/__tests__/frontMatter.test.ts
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,27 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {shouldQuotifyFrontMatter} from '../frontMatter'; | ||
|
||
describe('frontMatter', () => { | ||
test('shouldQuotifyFrontMatter', () => { | ||
expect(shouldQuotifyFrontMatter(['id', 'value'])).toEqual(false); | ||
expect( | ||
shouldQuotifyFrontMatter([ | ||
'title', | ||
"Some title front matter with allowed special chars like sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ!;,=+-_?'`&#()[]§%€$", | ||
]), | ||
).toEqual(false); | ||
|
||
expect(shouldQuotifyFrontMatter(['title', 'Special char :'])).toEqual(true); | ||
|
||
expect(shouldQuotifyFrontMatter(['title', 'value!'])).toEqual(false); | ||
expect(shouldQuotifyFrontMatter(['title', '!value'])).toEqual(true); | ||
|
||
expect(shouldQuotifyFrontMatter(['tags', '[tag1, tag2]'])).toEqual(false); | ||
}); | ||
}); |
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