@@ -232,5 +232,45 @@ describe("Test Infrastructure Integration", () => {
232232
233233 expect ( updatedNote . type ) . toBe ( "diagram" ) ;
234234 } ) ;
235+
236+ it ( "should create a code note when type is specified" , async ( ) => {
237+ const user = await createTestUser ( ) ;
238+ const note = await createTestNote ( user . id , null , {
239+ type : "code" ,
240+ title : "Code Snippet" ,
241+ content : '{"language":"javascript","code":"console.log(\'Hello\');"}' ,
242+ } ) ;
243+
244+ expect ( note . type ) . toBe ( "code" ) ;
245+ expect ( note . title ) . toBe ( "Code Snippet" ) ;
246+ expect ( note . content ) . toContain ( "javascript" ) ;
247+ } ) ;
248+
249+ it ( "should query notes by code type" , async ( ) => {
250+ const user = await createTestUser ( ) ;
251+ const folder = await createTestFolder ( user . id ) ;
252+
253+ // Create mixed note types including code
254+ await createTestNote ( user . id , folder . id , { type : "note" , title : "Regular Note" } ) ;
255+ await createTestNote ( user . id , folder . id , { type : "diagram" , title : "Diagram" } ) ;
256+ await createTestNote ( user . id , folder . id , {
257+ type : "code" ,
258+ title : "Code 1" ,
259+ content : '{"language":"python"}' ,
260+ } ) ;
261+ await createTestNote ( user . id , folder . id , {
262+ type : "code" ,
263+ title : "Code 2" ,
264+ content : '{"language":"typescript"}' ,
265+ } ) ;
266+
267+ // Query only code notes
268+ const codeNotes = await db . query . notes . findMany ( {
269+ where : eq ( notes . type , "code" ) ,
270+ } ) ;
271+
272+ expect ( codeNotes ) . toHaveLength ( 2 ) ;
273+ expect ( codeNotes . every ( ( n ) => n . type === "code" ) ) . toBe ( true ) ;
274+ } ) ;
235275 } ) ;
236276} ) ;
0 commit comments