import { describe, it, expect } from 'vitest'; import { NEWSLETTER_ISSUES } from './newsletterIssues'; describe('NEWSLETTER_ISSUES data', () => { it('has at least one issue', () => { expect(NEWSLETTER_ISSUES.length).toBeGreaterThan(0); }); it('every issue satisfies the schema', () => { for (const issue of NEWSLETTER_ISSUES) { expect(typeof issue.number).toBe('number'); expect(issue.date).toMatch(/^\d{4}-\d{2}-\d{2}$/); expect(issue.vibe.trim().length).toBeGreaterThan(0); expect(issue.communityNote.trim().length).toBeGreaterThan(0); expect(issue.nostrText.trim().length).toBeGreaterThan(0); expect(Array.isArray(issue.updates)).toBe(true); expect(issue.updates.length).toBeGreaterThan(0); for (const u of issue.updates) { expect(u.title.trim().length).toBeGreaterThan(0); expect(u.body.trim().length).toBeGreaterThan(0); expect(u.tag.trim().length).toBeGreaterThan(0); } } }); it('is ordered newest-first (descending issue numbers)', () => { for (let i = 1; i < NEWSLETTER_ISSUES.length; i++) { expect(NEWSLETTER_ISSUES[i - 1].number).toBeGreaterThan(NEWSLETTER_ISSUES[i].number); } }); it('includes the d-tagged hashtags used to publish issues', () => { const withNewsTag = NEWSLETTER_ISSUES.filter((i) => i.nostrText.includes('#skatespotsnews')); expect(withNewsTag.length).toBeGreaterThan(0); }); });