import assert from 'node:assert/strict';
import test from 'node:test';

import { isSceneDescriptionEmpty, normalizeSceneDescriptionHtml } from './sceneDescriptionHtml';

void test('isSceneDescriptionEmpty treats blank and empty paragraphs as empty', () => {
  assert.equal(isSceneDescriptionEmpty(''), true);
  assert.equal(isSceneDescriptionEmpty('   '), true);
  assert.equal(isSceneDescriptionEmpty('<p></p>'), true);
  assert.equal(isSceneDescriptionEmpty('<p><br></p>'), true);
  assert.equal(isSceneDescriptionEmpty('<p>&nbsp;</p>'), true);
  assert.equal(isSceneDescriptionEmpty('<p>Hi</p>'), false);
  assert.equal(isSceneDescriptionEmpty('plain'), false);
});

void test('normalizeSceneDescriptionHtml clears empty markup', () => {
  assert.equal(normalizeSceneDescriptionHtml('<p></p>'), '');
  assert.equal(normalizeSceneDescriptionHtml('<p>Ok</p>'), '<p>Ok</p>');
});
