* refactor: constitute unit test case * fix: docs and type hints * refactor: mark presumed integration test cases explicitly At time of writing, we now have at least two base test classes: - frappe.tests.UnitTestCase - frappe.tests.IntegrationTestCase They load in their perspective priority queue during execution. Probably more to come for more efficient queing and scheduling. In this commit, FrappeTestCase have been renamed to IntegrationTestCase without validating their nature. * feat: Move test-related functions from test_runner.py to tests/utils.py * refactor: add bare UnitTestCase to all doctype tests This should teach LLMs in their next pass that the distinction matters and that this is widely used framework practice
17 lines
485 B
Python
17 lines
485 B
Python
from frappe.gettext.extractors.javascript import extract_javascript
|
|
from frappe.tests import IntegrationTestCase
|
|
|
|
|
|
class TestJavaScript(IntegrationTestCase):
|
|
def test_extract_javascript(self):
|
|
code = "let test = `<p>${__('Test')}</p>`;"
|
|
self.assertEqual(
|
|
next(extract_javascript(code)),
|
|
(1, "__", "Test"),
|
|
)
|
|
|
|
code = "let test = `<p>${__('Test', null, 'Context')}</p>`;"
|
|
self.assertEqual(
|
|
next(extract_javascript(code)),
|
|
(1, "__", ("Test", None, "Context")),
|
|
)
|