25 lines
960 B
Python
25 lines
960 B
Python
|
|
"""The independent JS implementation (impl/js, MAS-WP-0009), where node is available."""
|
|||
|
|
import shutil
|
|||
|
|
import subprocess
|
|||
|
|
from pathlib import Path
|
|||
|
|
|
|||
|
|
import pytest
|
|||
|
|
|
|||
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|||
|
|
pytestmark = pytest.mark.skipif(not shutil.which("node"), reason="node not available")
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_js_passes_the_bundles_unchanged():
|
|||
|
|
# addresses.json, statute-aware.json and auth.json, read from the bundles in place
|
|||
|
|
proc = subprocess.run(["node", "--test"], cwd=ROOT / "impl/js", capture_output=True, text=True)
|
|||
|
|
assert proc.returncode == 0, proc.stdout[-2000:] + proc.stderr[-2000:]
|
|||
|
|
assert "# fail 0" in proc.stdout or "ℹ fail 0" in proc.stdout
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_js_outside_master_passes_the_slave_flows():
|
|||
|
|
from mas_modes.external import ExternalMaster
|
|||
|
|
from mas_modes.runner import run_mode_corpus
|
|||
|
|
rep = run_mode_corpus(master_factory=ExternalMaster.js, roles=("slave",))
|
|||
|
|
assert rep.ok, rep.failures
|
|||
|
|
assert rep.passed == 11
|