Desktop: folders keep claiming their store records before the config read returns; a store app with a folder's id is never listed twice

This commit is contained in:
CRTkafa 2026-10-23 09:18:03 +08:00
parent 5e82010ace
commit 7c769c18f4
3 changed files with 38 additions and 2 deletions

View file

@ -53,6 +53,21 @@ describe('identity pairing', () => {
const apps2 = buildApps({ projects: [prism], accounts, storeApps: twin, overrides: NO_OVERRIDES, summaryOf: () => summary('com.example.prism', 'com.example.prism') });
expect(apps2[0]!.ios?.account).toBe(A1);
});
test('a folder with a config summary claims its iOS and Android records; ignore flags do not break it', () => {
for (const o of [NO_OVERRIDES, withIgnored(NO_OVERRIDES, ['project:p1:ios'], true), withIgnored(NO_OVERRIDES, ['project:p1:android'], true)]) {
const apps = build(o);
expect(apps.filter(a => a.ios?.app.bundleId === 'com.example.prism' || a.android?.app.id === 'com.example.prism').length).toBeLessThanOrEqual(1);
expect(apps.filter(a => a.name === 'Prism' && !a.project)).toEqual([]);
}
});
test('without a summary the folder claims nothing (the start-up race); a store app of a folder bundle id is never shown separately', () => {
const none = buildApps({ projects: [prism], accounts, storeApps, overrides: NO_OVERRIDES, summaryOf: () => null });
expect(none.filter(a => !a.project && a.name === 'Prism')).toHaveLength(1);
// guard: the folder is linked to other records, its summary's ids still hide the duplicates
const linked = { ...NO_OVERRIDES, links: [{ key: `ios:${A1}:102`, project: 'p1' }] };
const apps = build(linked);
expect(apps.filter(a => !a.project && (a.ios?.app.bundleId === 'com.example.prism' || a.android?.app.id === 'com.example.prism'))).toEqual([]);
});
test('unpair blocks the automatic pair; manual pair beats it', () => {
const o1 = withUnpair(NO_OVERRIDES, `ios:${A1}:102`, `android:${P1}:com.example.orbit`);
const apps1 = build(o1);