File size: 619 Bytes
a1b6014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { describe, expect, it } from 'vitest'

import { resolveShowEarlierAction } from './transcript-window'

describe('resolveShowEarlierAction', () => {
  it('spends the already-materialized DOM page first', () => {
    expect(resolveShowEarlierAction(3, true)).toBe('dom')
    expect(resolveShowEarlierAction(3, false)).toBe('dom')
  })

  it('expands the store window once the DOM page is exhausted', () => {
    expect(resolveShowEarlierAction(0, true)).toBe('window')
  })

  it('is a no-op when neither DOM nor store has older content', () => {
    expect(resolveShowEarlierAction(0, false)).toBe(null)
  })
})