2026-04-22 14:20:09 +00:00
|
|
|
import { describe, test, expect } from 'bun:test'
|
2026-05-03 18:03:40 +00:00
|
|
|
|
2026-05-05 23:05:02 +00:00
|
|
|
import { createEditorStore } from '@/app/editor/session'
|
2026-04-22 14:20:09 +00:00
|
|
|
|
|
|
|
|
describe('setPlannedFilePath', () => {
|
|
|
|
|
test('sets document name from file path', () => {
|
|
|
|
|
const store = createEditorStore()
|
|
|
|
|
store.setPlannedFilePath('/tmp/projects/my-design.fig')
|
|
|
|
|
expect(store.state.documentName).toBe('my-design')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('handles Windows-style paths', () => {
|
|
|
|
|
const store = createEditorStore()
|
|
|
|
|
store.setPlannedFilePath('C:\\Users\\test\\design.fig')
|
|
|
|
|
expect(store.state.documentName).toBe('design')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
test('handles path without extension', () => {
|
|
|
|
|
const store = createEditorStore()
|
|
|
|
|
store.setPlannedFilePath('/tmp/Untitled')
|
|
|
|
|
expect(store.state.documentName).toBe('Untitled')
|
|
|
|
|
})
|
|
|
|
|
})
|