@@ -247,6 +247,73 @@ async def test_move_note_missing_file_extension(client, test_project):
247247 assert "Testing extension validation" in content
248248
249249
250+ @pytest .mark .asyncio
251+ async def test_move_note_file_extension_mismatch (client , test_project ):
252+ """Test that moving note with different extension is blocked."""
253+ # Create initial note with .md extension
254+ await write_note .fn (
255+ project = test_project .name ,
256+ title = "MarkdownNote" ,
257+ folder = "source" ,
258+ content = "# Markdown Note\n This is a markdown file." ,
259+ )
260+
261+ # Try to move with .txt extension
262+ result = await move_note .fn (
263+ project = test_project .name ,
264+ identifier = "source/markdown-note" ,
265+ destination_path = "target/renamed-note.txt" ,
266+ )
267+
268+ # Should return error about extension mismatch
269+ assert isinstance (result , str )
270+ assert "# Move Failed - File Extension Mismatch" in result
271+ assert "does not match the source file extension" in result
272+ assert ".md" in result
273+ assert ".txt" in result
274+ assert "renamed-note.md" in result # Should suggest correct extension
275+
276+ # Test that note still exists at original location with original extension
277+ content = await read_note .fn ("source/markdown-note" , project = test_project .name )
278+ assert "# Markdown Note" in content
279+ assert "This is a markdown file" in content
280+
281+
282+ @pytest .mark .asyncio
283+ async def test_move_note_preserves_file_extension (client , test_project ):
284+ """Test that moving note with matching extension succeeds."""
285+ # Create initial note with .md extension
286+ await write_note .fn (
287+ project = test_project .name ,
288+ title = "PreserveExtension" ,
289+ folder = "source" ,
290+ content = "# Preserve Extension\n Testing that extension is preserved." ,
291+ )
292+
293+ # Move with same .md extension
294+ result = await move_note .fn (
295+ project = test_project .name ,
296+ identifier = "source/preserve-extension" ,
297+ destination_path = "target/preserved-note.md" ,
298+ )
299+
300+ # Should succeed
301+ assert isinstance (result , str )
302+ assert "✅ Note moved successfully" in result
303+
304+ # Verify note exists at new location with same extension
305+ content = await read_note .fn ("target/preserved-note" , project = test_project .name )
306+ assert "# Preserve Extension" in content
307+ assert "Testing that extension is preserved" in content
308+
309+ # Verify old location no longer exists
310+ try :
311+ await read_note .fn ("source/preserve-extension" )
312+ assert False , "Original note should not exist after move"
313+ except Exception :
314+ pass # Expected
315+
316+
250317@pytest .mark .asyncio
251318async def test_move_note_destination_exists (client , test_project ):
252319 """Test moving note to existing destination."""
0 commit comments