feat(server): library refresh go brrr (#14456)

* feat: brr

---------
Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
This commit is contained in:
Jonathan Jogenfors 2025-03-06 16:00:18 +01:00 committed by GitHub
parent bc61497461
commit 3af26ee94a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 855 additions and 531 deletions

View file

@ -1,4 +1,4 @@
import { getKeysDeep, unsetDeep } from 'src/utils/misc';
import { getKeysDeep, globToSqlPattern, unsetDeep } from 'src/utils/misc';
import { describe, expect, it } from 'vitest';
describe('getKeysDeep', () => {
@ -51,3 +51,19 @@ describe('unsetDeep', () => {
expect(unsetDeep({ foo: 'bar', nested: { enabled: true } }, 'nested.enabled')).toEqual({ foo: 'bar' });
});
});
describe('globToSqlPattern', () => {
const testCases = [
['**/Raw/**', '%/Raw/%'],
['**/abc/*.tif', '%/abc/%.tif'],
['**/*.tif', '%/%.tif'],
['**/*.jp?', '%/%.jp_'],
['**/@eaDir/**', '%/@eaDir/%'],
['**/._*', `%/._%`],
['/absolute/path/**', `/absolute/path/%`],
];
it.each(testCases)('should convert %s to %s', (input, expected) => {
expect(globToSqlPattern(input)).toEqual(expected);
});
});