From f2954945beb4e46565c1096e52cc2b81612b56b0 Mon Sep 17 00:00:00 2001 From: Bounty13 Date: Thu, 16 Jul 2026 22:37:53 +0000 Subject: [PATCH] test(desktop): add regression test for Photon messaging source (#46761) Assert isMessagingSource('photon') is true and that Photon/iMessage search aliases resolve, so a silent removal of the photon entry from MESSAGING_SESSION_SOURCE_IDS fails CI instead of regressing the sidebar section added in #47395. --- apps/desktop/src/lib/session-source.test.ts | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 apps/desktop/src/lib/session-source.test.ts diff --git a/apps/desktop/src/lib/session-source.test.ts b/apps/desktop/src/lib/session-source.test.ts new file mode 100644 index 000000000000..8d35ad1f406b --- /dev/null +++ b/apps/desktop/src/lib/session-source.test.ts @@ -0,0 +1,39 @@ +import { describe, expect, it } from 'vitest' + +import { + MESSAGING_SESSION_SOURCE_IDS, + isMessagingSource, + sessionSourceSearchTerms +} from './session-source' + +// Regression guard for #46761 / PR #47395: Photon (iMessage) must keep its own +// sidebar section. refreshMessagingSessions() filters rows through +// isMessagingSource(), so this entry is the sole condition that keeps Photon +// sessions out of generic recents. A silent removal would regress the feature +// with no test failure — these asserts pin the contract. +describe('photon messaging source registration', () => { + it('treats photon as a messaging source (own sidebar section)', () => { + expect(isMessagingSource('photon')).toBe(true) + }) + + it('is case/space insensitive on the source id', () => { + expect(isMessagingSource('PHOTON')).toBe(true) + expect(isMessagingSource(' photon ')).toBe(true) + }) + + it('exposes the iMessage/messages search aliases so Photon sessions are findable', () => { + const terms = sessionSourceSearchTerms('photon') + expect(terms).toContain('imessage') + expect(terms).toContain('messages') + }) + + it('is registered in the messaging source id list', () => { + expect(MESSAGING_SESSION_SOURCE_IDS).toContain('photon') + }) + + it('does not flag local/CLI-ish sources as messaging (guard sanity)', () => { + expect(isMessagingSource('cli')).toBe(false) + expect(isMessagingSource(null)).toBe(false) + expect(isMessagingSource(undefined)).toBe(false) + }) +})