You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-27 23:28:38 +02:00
Tools: Updated script to build plugin repository
This commit is contained in:
33
packages/lib/services/plugins/utils/validatePluginId.test.ts
Normal file
33
packages/lib/services/plugins/utils/validatePluginId.test.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import validatePluginId from './validatePluginId';
|
||||
|
||||
describe('validatePluginId', () => {
|
||||
|
||||
test('should validate an ID', () => {
|
||||
const okCases = [
|
||||
'thatsok',
|
||||
'that-s-ok',
|
||||
'that_s_fine12',
|
||||
'com.ok.too',
|
||||
];
|
||||
|
||||
const errorCases = [
|
||||
'',
|
||||
'verylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongid',
|
||||
'NO',
|
||||
'NotGood',
|
||||
'-shouldstartwiththis',
|
||||
'shouldntendwithit.',
|
||||
' no space ',
|
||||
'no space',
|
||||
];
|
||||
|
||||
for (const t of okCases) {
|
||||
expect(() => validatePluginId(t)).not.toThrow();
|
||||
}
|
||||
|
||||
for (const t of errorCases) {
|
||||
expect(() => validatePluginId(t)).toThrow();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user