From e4a4b78b1230b759f0a3c4df2d98ccf6689eb934 Mon Sep 17 00:00:00 2001 From: nicwands Date: Mon, 2 Mar 2026 11:48:31 -0500 Subject: [PATCH] Update testPlugin to use new note storage format --- src/testPlugin.ts | 29 +++++++++++++---------------- src/validatePlugin.ts | 2 +- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/testPlugin.ts b/src/testPlugin.ts index 129798a..db8a66c 100644 --- a/src/testPlugin.ts +++ b/src/testPlugin.ts @@ -2,18 +2,15 @@ import { validatePlugin } from './validatePlugin' export interface TestNote { id: string - title: string - content: string - createdAt: string - updatedAt: string + data: string } -export const createTestNote = (id: string = 'test-note-1'): TestNote => ({ +export const createTestNote = ( + id: string = 'test-note-1', + data?: string, +): TestNote => ({ id, - title: 'Test Note', - content: 'Test content', - createdAt: new Date().toISOString(), - updatedAt: new Date().toISOString(), + data: data || 'test-data', }) export interface TestPluginOptions { @@ -82,19 +79,19 @@ export const runPluginTests = ({ plugin, adapter }: TestPluginOptions) => { it('should update a note without errors', async () => { const note = createTestNote('test-update-note') await adapter.create(note) - const updatedNote = { ...note, content: 'Updated content' } + const updatedNote = { ...note, data: 'Updated data' } await adapter.update(updatedNote) }) it('updated note should reflect changes', async () => { const note = createTestNote('test-update-note-2') await adapter.create(note) - const updatedNote = { ...note, title: 'Updated Title' } + const updatedNote = { ...note, data: 'Updated data v2' } await adapter.update(updatedNote) const notes = await adapter.getAll() const found = notes.find((n: any) => n.id === note.id) - if (found?.title !== 'Updated Title') { - throw new Error('Updated note title does not match') + if (found?.data !== 'Updated data v2') { + throw new Error('Updated note data does not match') } }) }, @@ -128,14 +125,14 @@ export const runPluginTests = ({ plugin, adapter }: TestPluginOptions) => { throw new Error('Created note not found') } - const updatedNote = { ...note, title: 'CRUD update' } + const updatedNote = { ...note, data: 'CRUD update' } await adapter.update(updatedNote) notes = await adapter.getAll() if ( - notes.find((n: any) => n.id === note.id)?.title !== + notes.find((n: any) => n.id === note.id)?.data !== 'CRUD update' ) { - throw new Error('Updated note content does not match') + throw new Error('Updated note data does not match') } await adapter.delete(note.id) diff --git a/src/validatePlugin.ts b/src/validatePlugin.ts index 61e8dc0..2519c6a 100644 --- a/src/validatePlugin.ts +++ b/src/validatePlugin.ts @@ -1,6 +1,6 @@ import { z } from 'zod' -export const SUPPORTED_API_VERSION = '0.1.0' +export const SUPPORTED_API_VERSION = '0.3.0' const ConfigFieldSchema = z.object({ key: z.string(),