gridresilience-studio-offli.../tests/test_offline_sync_basic.py

17 lines
657 B
Python

from gridresilience_studio.core import PlanDelta
from gridresilience_studio.offline_sync import DeltaSyncEngine, DeltaStore, Object, Morphism
from gridresilience_studio.core import build_sample_world
def test_offline_sync_basic_delta_application():
# Start with a small in-memory world
ds = build_sample_world()
engine = DeltaSyncEngine(ds)
# Create a simple delta and apply
delta = PlanDelta(delta_id="DELTA_TEST", islanded=False, actions=[{"type": "noop"}], tags={})
engine.apply_delta(delta)
# Validate that the delta was recorded in the local store
assert any(d.delta_id == "DELTA_TEST" for d in engine.store.deltas)