mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-12 08:54:00 +02:00
33 lines
830 B
TypeScript
33 lines
830 B
TypeScript
import validatePluginId from './validatePluginId';
|
|
|
|
describe('validatePluginId', () => {
|
|
|
|
test('should validate an ID', () => {
|
|
const okCases = [
|
|
'thatsok',
|
|
'that-s-ok',
|
|
'that_s_fine12',
|
|
'com.ok.too',
|
|
'Good',
|
|
];
|
|
|
|
const errorCases = [
|
|
'',
|
|
'verylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongidverylongid',
|
|
'-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();
|
|
}
|
|
});
|
|
|
|
});
|