The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop): trim social embed tests to the isolation invariants
kshitijk4poor8dfcfc02c799
diff --git a/apps/desktop/src/components/assistant-ui/embeds/social-embed.test.tsx b/apps/desktop/src/components/assistant-ui/embeds/social-embed.test.tsxindex 2b2dcd53d37..99f09fea6cd 100644--- a/apps/desktop/src/components/assistant-ui/embeds/social-embed.test.tsx+++ b/apps/desktop/src/components/assistant-ui/embeds/social-embed.test.tsx@@ -2,7 +2,7 @@ import { act, cleanup, render } from '@testing-library/react'import { afterEach, describe, expect, it } from 'vitest'import { detectEmbed } from './providers'-import SocialEmbedRenderer, { reportedHeight } from './social-embed'+import SocialEmbedRenderer from './social-embed'afterEach(() => {cleanup()@@ -49,36 +49,6 @@ describe('SocialEmbedRenderer', () => {expect(frame.getAttribute('referrerpolicy')).toBe('strict-origin-when-cross-origin')})- it('passes the app theme to the tweet frame', () => {- globalThis.document.documentElement.classList.add('dark')-- expect(new URL(renderEmbed('https://twitter.com/jack/status/20').src).searchParams.get('theme')).toBe('dark')- })-- it("sizes the tweet frame from X's resize message", () => {- const frame = renderEmbed('https://x.com/jack/status/20')-- post(frame, 'https://platform.twitter.com', {- 'twttr.embed': {- id: 'embed-0',- jsonrpc: '2.0',- method: 'twttr.private.resize',- params: [{ height: 225, width: 480 }]- }- })-- expect(frame.style.height).toBe('225px')- })-- it('sizes the Instagram frame from its MEASURE message', () => {- const frame = renderEmbed('https://www.instagram.com/p/CabcDEF123/')-- expect(frame.style.height).toBe('450px')- post(frame, 'https://www.instagram.com', JSON.stringify({ details: { height: 608 }, type: 'MEASURE' }))-- expect(frame.style.height).toBe('608px')- })-it('ignores height messages from another origin or another window', () => {const frame = renderEmbed('https://www.instagram.com/p/CabcDEF123/')const measure = JSON.stringify({ details: { height: 999 }, type: 'MEASURE' })@@ -89,17 +59,3 @@ describe('SocialEmbedRenderer', () => {expect(frame.style.height).toBe('450px')})})--describe('reportedHeight', () => {- it('reads only a positive finite height', () => {- expect(reportedHeight('{"type":"MEASURE","details":{"height":608.2}}')).toBe(609)- expect(reportedHeight({ 'twttr.embed': { method: 'twttr.private.resize', params: [{ height: 225 }] } })).toBe(225)- expect(- reportedHeight({ 'twttr.embed': { method: 'twttr.private.rendered', params: [{ height: 225 }] } })- ).toBeNull()- expect(reportedHeight('{"type":"MEASURE","details":{"height":"9e9"}}')).toBeNull()- expect(reportedHeight({ type: 'MEASURE', details: { height: -1 } })).toBeNull()- expect(reportedHeight('not json')).toBeNull()- expect(reportedHeight(null)).toBeNull()- })-})