Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto substandard.blog
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263import { describe, expect, it } from 'vitest'
import { restoreScanView, threadTitle } from './scan-view'
describe('restoreScanView', () => { it('opens the first page when nothing was remembered', () => { expect(restoreScanView(undefined, 50)).toEqual({ showLower: false, resultLimit: 50, scrollY: 0, criteriaOpen: false, openScores: [], }) })
it('restores the toggles, limit, scroll and open score panels', () => { expect( restoreScanView( { showLower: true, resultLimit: 150, scrollY: 420, criteriaOpen: true, openScores: ['at://did:plc:example/app.bsky.feed.post/one'], }, 50, ), ).toEqual({ showLower: true, resultLimit: 150, scrollY: 420, criteriaOpen: true, openScores: ['at://did:plc:example/app.bsky.feed.post/one'], }) })
it('falls back when remembered values are malformed', () => { expect( restoreScanView( { resultLimit: 0, scrollY: Number.NaN, openScores: ['at://kept', 7], } as unknown as Parameters<typeof restoreScanView>[0], 50, ), ).toEqual({ showLower: false, resultLimit: 50, scrollY: 0, criteriaOpen: false, openScores: ['at://kept'], }) })})
describe('threadTitle', () => { it('names the thread or falls back while it loads', () => { expect(threadTitle('A thread worth a post')).toBe('A thread worth a post — THREADBARE') expect(threadTitle('')).toBe('Thread — THREADBARE') })})