@@ -8,9 +8,18 @@ describe('DevlogManager', () => {
88 let testWorkspace : string ;
99
1010 beforeEach ( async ( ) => {
11- // Create a temporary test workspace
12- testWorkspace = path . join ( process . cwd ( ) , 'test-workspace-' + Date . now ( ) ) ;
13- manager = new DevlogManager ( { workspaceRoot : testWorkspace } ) ;
11+ // Create a temporary test workspace with unique name
12+ testWorkspace = path . join ( process . cwd ( ) , 'test-workspace-' + Date . now ( ) + '-' + Math . random ( ) . toString ( 36 ) . substr ( 2 , 9 ) ) ;
13+
14+ // Create isolated storage config for each test
15+ const sqliteDbPath = path . join ( testWorkspace , 'test.db' ) ;
16+ manager = new DevlogManager ( {
17+ workspaceRoot : testWorkspace ,
18+ storage : {
19+ type : 'sqlite' ,
20+ filePath : sqliteDbPath
21+ }
22+ } ) ;
1423 } ) ;
1524
1625 afterEach ( async ( ) => {
@@ -22,9 +31,9 @@ describe('DevlogManager', () => {
2231 }
2332 } ) ;
2433
25- describe ( 'createDevlog ' , ( ) => {
34+ describe ( 'findOrCreateDevlog ' , ( ) => {
2635 it ( 'should create a new devlog entry' , async ( ) => {
27- const result = await manager . createDevlog ( {
36+ const result = await manager . findOrCreateDevlog ( {
2837 title : 'Test Feature' ,
2938 type : 'feature' ,
3039 description : 'A test feature' ,
@@ -44,7 +53,7 @@ describe('DevlogManager', () => {
4453
4554 it ( 'should create a devlog with custom ID' , async ( ) => {
4655 const customId = 'my-custom-id' ;
47- const result = await manager . createDevlog ( {
56+ const result = await manager . findOrCreateDevlog ( {
4857 id : customId ,
4958 title : 'Custom ID Test' ,
5059 type : 'task' ,
@@ -230,10 +239,7 @@ describe('DevlogManager', () => {
230239 description : 'Testing notes'
231240 } ) ;
232241
233- const result = await manager . addNote ( created . id , {
234- category : 'progress' ,
235- content : 'Made some progress on this task'
236- } ) ;
242+ const result = await manager . addNote ( created . id , 'Made some progress on this task' , 'progress' ) ;
237243
238244 expect ( result . notes ) . toHaveLength ( 1 ) ;
239245 expect ( result . notes [ 0 ] . content ) . toBe ( 'Made some progress on this task' ) ;
0 commit comments