1
0
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:
Laurent Cozic
2021-01-06 20:23:23 +00:00
parent 420ac8359c
commit 8d4d438136
5 changed files with 63 additions and 3 deletions

View 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();
}
});
});