mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
fix existing unit tests
This commit is contained in:
parent
83b37c7337
commit
bb747096c8
1 changed files with 15 additions and 4 deletions
|
|
@ -38,13 +38,24 @@ class TestResolveImport:
|
|||
|
||||
def test_class_method(self) -> None:
|
||||
assert _resolve_import("Validator.validateRequest", "../middlewares/Validator") == (
|
||||
"named",
|
||||
"Validator",
|
||||
"Validator.validateRequest",
|
||||
)
|
||||
|
||||
def test_class_method_default_export(self) -> None:
|
||||
assert _resolve_import(
|
||||
"Validator.validateRequest",
|
||||
"../middlewares/Validator",
|
||||
"export default class Validator { validateRequest() {} }",
|
||||
) == (
|
||||
"default",
|
||||
"Validator",
|
||||
"Validator.validateRequest",
|
||||
)
|
||||
|
||||
def test_static_method(self) -> None:
|
||||
assert _resolve_import("Utils.formatDate", "../utils/Utils") == ("default", "Utils", "Utils.formatDate")
|
||||
assert _resolve_import("Utils.formatDate", "../utils/Utils") == ("named", "Utils", "Utils.formatDate")
|
||||
|
||||
def test_function_with_underscore(self) -> None:
|
||||
assert _resolve_import("get_git_root", "../utils/git") == ("named", "get_git_root", "get_git_root")
|
||||
|
|
@ -263,7 +274,7 @@ class TestBuildJavascriptPrompt:
|
|||
def test_esm_default_import(self) -> None:
|
||||
messages, _ = build_javascript_prompt(
|
||||
function_name="Svc.run",
|
||||
function_code="class Svc { run() {} }",
|
||||
function_code="export default class Svc { run() {} }",
|
||||
module_path="../services/Svc",
|
||||
test_framework="vitest",
|
||||
is_async=False,
|
||||
|
|
@ -292,7 +303,7 @@ class TestBuildJavascriptPrompt:
|
|||
def test_cjs_class_method(self) -> None:
|
||||
messages, _ = build_javascript_prompt(
|
||||
function_name="Validator.validateRequest",
|
||||
function_code="class Validator { validateRequest() {} }",
|
||||
function_code="export default class Validator { validateRequest() {} }",
|
||||
module_path="../middlewares/Validator",
|
||||
test_framework="jest",
|
||||
is_async=False,
|
||||
|
|
@ -306,7 +317,7 @@ class TestBuildJavascriptPrompt:
|
|||
def test_cjs_class_method_async(self) -> None:
|
||||
messages, suffix = build_javascript_prompt(
|
||||
function_name="Controller.asyncMethod",
|
||||
function_code="class Controller { async asyncMethod() {} }",
|
||||
function_code="export default class Controller { async asyncMethod() {} }",
|
||||
module_path="../controllers/Controller",
|
||||
test_framework="jest",
|
||||
is_async=True,
|
||||
|
|
|
|||
Loading…
Reference in a new issue