test_llms_txt_parser.py 704 B

12345678910111213141516171819202122232425262728293031323334
  1. import pytest
  2. from skill_seekers.cli.llms_txt_parser import LlmsTxtParser
  3. def test_parse_markdown_sections():
  4. """Test parsing markdown into page sections"""
  5. sample_content = """# Getting Started
  6. Welcome to the docs.
  7. ## Installation
  8. Run: npm install
  9. ## Usage
  10. Import the library:
  11. ```javascript
  12. import { app } from 'framework'
  13. ```
  14. # API Reference
  15. Main API documentation here.
  16. """
  17. parser = LlmsTxtParser(sample_content)
  18. pages = parser.parse()
  19. assert len(pages) >= 2
  20. assert pages[0]['title'] == 'Getting Started'
  21. assert pages[1]['title'] == 'API Reference'
  22. assert len(pages[0]['code_samples']) == 1
  23. assert pages[0]['code_samples'][0]['language'] == 'javascript'