Skip to content

Commit 385a564

Browse files
Sync public snapshot from freebuff-private
1 parent cc43f20 commit 385a564

3 files changed

Lines changed: 421 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { describe, expect, test } from 'bun:test'
2+
3+
import { FEATURED_INTEGRATIONS } from '../../desktop-cloud/integrations'
4+
import {
5+
HOUSE_GROWTH_CAMPAIGNS,
6+
HOUSE_GROWTH_INTEGRATION_CAMPAIGNS,
7+
houseCampaignGateFor,
8+
integrationSlugForGate,
9+
} from '../freebuff-house-growth-ads'
10+
import { HOUSE_PRODUCT_CAMPAIGN_IDS } from '../freebuff-house-product-ads'
11+
12+
describe('growth house campaign catalog', () => {
13+
test('ids are unique, stable and never collide with the product tips', () => {
14+
const ids = HOUSE_GROWTH_CAMPAIGNS.map((campaign) => campaign.id)
15+
expect(new Set(ids).size).toBe(ids.length)
16+
for (const id of ids) {
17+
expect(id).toMatch(/^house-growth-[a-z0-9-]+-v1$/)
18+
expect(Object.values(HOUSE_PRODUCT_CAMPAIGN_IDS)).not.toContain(id)
19+
}
20+
})
21+
22+
test('one gated campaign per featured integration', () => {
23+
expect(
24+
HOUSE_GROWTH_INTEGRATION_CAMPAIGNS.map((campaign) =>
25+
integrationSlugForGate(campaign.gate!),
26+
),
27+
).toEqual([...FEATURED_INTEGRATIONS])
28+
})
29+
30+
test('every creative links over https and fits the CLI preview', () => {
31+
for (const campaign of HOUSE_GROWTH_CAMPAIGNS) {
32+
expect(campaign.creatives.length).toBeGreaterThan(0)
33+
const destinations = new Set(campaign.creatives.map((c) => c.url))
34+
// The seed requires one reviewed destination per campaign.
35+
expect(destinations.size).toBe(1)
36+
for (const creative of campaign.creatives) {
37+
expect(creative.url.startsWith('https://')).toBe(true)
38+
// The 48-column CLI baseline the Discord headlines target.
39+
expect(creative.title.length).toBeLessThanOrEqual(48)
40+
expect(creative.adText.length).toBeLessThanOrEqual(80)
41+
}
42+
}
43+
})
44+
45+
test('the gate map answers by id and ignores unknown ids', () => {
46+
expect(houseCampaignGateFor('house-growth-desktop-v1')).toBe('desktop_user')
47+
expect(houseCampaignGateFor('house-growth-referrals-v1')).toBeNull()
48+
expect(houseCampaignGateFor('house-product-sites-v1')).toBeNull()
49+
})
50+
})

0 commit comments

Comments
 (0)