feat: podpora více odkazů na podnik při objednávání

This commit is contained in:
mates committed 2026-08-25 11:28:57 +02:00
1 parent 93242b7c7e
commit ce051447e6
13 files changed
+338 -81

No files matched your search

+36
View File
@@ -40,6 +40,42 @@ describe('createGroup', () => {
expect(d2.groups).toHaveLength(2);
expect(d2.groups![1].id).not.toBe(d2.groups![0].id);
});
describe('výběr URL na nabídku', () => {
const MULTI_STORE = 'Bistro';
const WOLT_URL = 'https://wolt.com/bistro';
const BOLT_URL = 'https://food.bolt.eu/bistro';
beforeEach(async () => {
await addStore(MULTI_STORE, ADMIN_PW, [WOLT_URL, BOLT_URL]);
});
test('uloží vybranou URL do skupiny', async () => {
const data = await createGroup(CREATOR, MULTI_STORE, TODAY, BOLT_URL);
expect(data.groups![0].url).toBe(BOLT_URL);
});
test('odmítne URL, která k obchodu nepatří', async () => {
await expect(createGroup(CREATOR, MULTI_STORE, TODAY, 'https://wolt.com/jine'))
.rejects.toThrow('nepatří');
});
test('bez výběru zůstane skupina bez URL, když má obchod více nabídek', async () => {
const data = await createGroup(CREATOR, MULTI_STORE, TODAY);
expect(data.groups![0].url).toBeUndefined();
});
test('dosadí jedinou URL obchodu automaticky', async () => {
await addStore('Pizzerie', ADMIN_PW, [WOLT_URL]);
const data = await createGroup(CREATOR, 'Pizzerie', TODAY);
expect(data.groups![0].url).toBe(WOLT_URL);
});
test('obchod bez URL vytvoří skupinu bez URL', async () => {
const data = await createGroup(CREATOR, STORE, TODAY);
expect(data.groups![0].url).toBeUndefined();
});
});
});
describe('deleteGroup', () => {