Coverage for src/tests/frontend/test_development_vite.py: 100%
16 statements
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2024-01-01 00:00 +0000
1"""Module for testing the development vite class."""
3import pytest
5from kwai_api.frontend.vite import DevelopmentVite, Vite
8@pytest.fixture
9def vite() -> Vite:
10 """A fixture for vite development."""
11 vite = DevelopmentVite("http://localhost:5173")
12 vite.init("src/index.ts")
13 return vite
16def test_development_vite_scripts(vite: Vite):
17 """Test the development version of the Vite class for script tags."""
18 scripts = vite.get_scripts("")
19 assert len(scripts) == 2, "There should be 2 script tags"
20 assert scripts[0] == "http://localhost:5173/@vite/client"
21 assert scripts[1] == "http://localhost:5173/src/index.ts"
24def test_development_vite_css(vite: Vite):
25 """Test the development version of the Vite class for css tags."""
26 assert len(vite.get_css("")) == 0, "There should be no css in development"
29def test_development_vite_preload(vite: Vite):
30 """Test the development version of the Vite class for preload tags."""
31 assert len(vite.get_preloads("")) == 0, "There should be no preload in development"