Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
brichet committed Aug 30, 2024
1 parent 9eafb7e commit 7fb6f81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def __init__(self, mapping: dict):
def get_path(self, id: str) -> str:
return self.mapping[id]

def move(self, id: str, new_path: str) -> None:
self.mapping[id] = new_path


class FakeContentsManager:
def __init__(self, model: dict):
Expand Down
19 changes: 19 additions & 0 deletions tests/test_rooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,22 @@ async def test_undefined_save_delay_should_not_save_content_after_document_chang
await asyncio.sleep(0.15)

assert "save" not in cm.actions


async def test_document_path(rtc_create_mock_document_room):
id = "test-id"
path = "test.txt"
new_path = "test2.txt"

_, loader, room = rtc_create_mock_document_room(id, path, "")

await room.initialize()
assert room._document.path == path

# Update the path
loader._file_id_manager.move(id, new_path)

# Wait for a bit more than the poll_interval
await asyncio.sleep(0.15)

assert room._document.path == new_path

0 comments on commit 7fb6f81

Please sign in to comment.