feat: zvýraznění dnů v historii obsahujících objednávky
CI / Generate TypeScript types (push) Successful in 12s
CI / Server unit tests (push) Successful in 20s
CI / Build server (push) Successful in 24s
CI / Build client (push) Successful in 36s
CI / Playwright E2E tests (push) Successful in 1m17s
CI / Build and push Docker image (push) Successful in 40s
CI / Notify (push) Successful in 2s
CI / Generate TypeScript types (push) Successful in 12s
CI / Server unit tests (push) Successful in 20s
CI / Build server (push) Successful in 24s
CI / Build client (push) Successful in 36s
CI / Playwright E2E tests (push) Successful in 1m17s
CI / Build and push Docker image (push) Successful in 40s
CI / Notify (push) Successful in 2s
This commit is contained in:
@@ -26,6 +26,10 @@ const implementations: [string, () => StorageInterface, () => void][] = [
|
||||
inst.hasData = async (key: string) => Promise.resolve((inst as any).db.has(key));
|
||||
inst.getData = async (key: string) => (inst as any).db.get(key);
|
||||
inst.setData = async (key: string, data: any) => { (inst as any).db.set(key, data); return Promise.resolve(); };
|
||||
inst.listKeys = async (contains?: string) => {
|
||||
const keys = Object.keys((inst as any).db.JSON());
|
||||
return contains ? keys.filter((k: string) => k.includes(contains)) : keys;
|
||||
};
|
||||
return inst;
|
||||
}, () => {
|
||||
if (fs.existsSync(tempDbPath)) {
|
||||
@@ -76,6 +80,22 @@ describe.each(implementations)('%s splňuje StorageInterface kontrakt', (name, f
|
||||
expect((await storage.getData<{ val: string }>('a'))?.val).toBe('A');
|
||||
expect((await storage.getData<{ val: string }>('b'))?.val).toBe('B');
|
||||
});
|
||||
|
||||
test('listKeys vrátí všechny uložené klíče', async () => {
|
||||
await storage.setData('2024-01-01_extra', {});
|
||||
await storage.setData('2024-01-02', {});
|
||||
const keys = await storage.listKeys();
|
||||
expect(keys).toContain('2024-01-01_extra');
|
||||
expect(keys).toContain('2024-01-02');
|
||||
});
|
||||
|
||||
test('listKeys filtruje podle podřetězce', async () => {
|
||||
await storage.setData('2024-01-01_extra', {});
|
||||
await storage.setData('2024-01-02_extra', {});
|
||||
await storage.setData('2024-01-02', {});
|
||||
const keys = await storage.listKeys('_extra');
|
||||
expect(keys.sort()).toEqual(['2024-01-01_extra', '2024-01-02_extra']);
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
||||
Reference in New Issue
Block a user