e30e75b5d4
Code Quality / Oxlint + Oxfmt (push) Waiting to run
Code Quality / Template Sync (push) Waiting to run
Code Quality / Build Changed Packages (push) Waiting to run
Code Quality / Test Changed Packages (push) Waiting to run
Deploy Expo Example / Deploy Production (push) Waiting to run
Deploy Ink Example / Deploy Production (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-stream, 3.12) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.10) (push) Waiting to run
Python Tests / pytest (assistant-ui-sync-server-api, 3.12) (push) Waiting to run
Deploy Shadcn Registry / Deploy Production (push) Waiting to run
Template Metrics / LOC + Bundle Size (push) Waiting to run
Changesets / Create Version PR (push) Has been cancelled
18 lines
587 B
Python
18 lines
587 B
Python
import json
|
|
|
|
from assistant_stream.assistant_stream_chunk import UpdateStateChunk
|
|
from assistant_stream.serialization.data_stream import DataStreamEncoder
|
|
|
|
|
|
def test_data_stream_encoder_update_state_shape() -> None:
|
|
encoder = DataStreamEncoder()
|
|
operations = [
|
|
{"type": "append-text", "path": ["messages", "0", "text"], "value": "hi"}
|
|
]
|
|
|
|
encoded = encoder.encode_chunk(UpdateStateChunk(operations=operations))
|
|
|
|
assert encoded.startswith("aui-state:")
|
|
assert encoded.endswith("\n")
|
|
assert json.loads(encoded[len("aui-state:") :].strip()) == operations
|