import assert from 'node:assert/strict'

import { resolveKnowledgePreviewLayoutState } from '../src/views/scripts/knowledgePreviewLayout.js'

function testUsesLibraryOnlyLayoutWithoutSelection() {
  assert.deepEqual(resolveKnowledgePreviewLayoutState(null), {
    isPreviewModalOpen: false,
    usesSplitLayout: false
  })
}

function testUsesModalPreviewLayoutWhenDocumentIsSelected() {
  assert.deepEqual(resolveKnowledgePreviewLayoutState({ id: 'doc-1' }), {
    isPreviewModalOpen: true,
    usesSplitLayout: false
  })
}

function run() {
  testUsesLibraryOnlyLayoutWithoutSelection()
  testUsesModalPreviewLayoutWhenDocumentIsSelected()
  console.log('knowledge preview layout tests passed')
}

run()
