update adapter to encrypted format
This commit is contained in:
45
test/plugin.test.js
Normal file
45
test/plugin.test.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import { describe, it } from 'vitest'
|
||||
import { runPluginTests } from '@takerofnotes/plugin-sdk'
|
||||
import plugin from './src/index.js'
|
||||
import FileSystemAdapter from './src/FileSystemAdapter.js'
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
import fs from 'fs'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const testDir = path.join(__dirname, 'test-notes')
|
||||
|
||||
if (!fs.existsSync(testDir)) {
|
||||
fs.mkdirSync(testDir, { recursive: true })
|
||||
}
|
||||
|
||||
const adapter = new FileSystemAdapter({ notesDir: testDir })
|
||||
const tests = runPluginTests({ plugin, adapter })
|
||||
|
||||
describe('Plugin Validation', () => {
|
||||
tests.validatePlugin(it, (a, b) => expect(a).toBe(b))
|
||||
})
|
||||
|
||||
describe('Adapter: init()', () => {
|
||||
tests.init(it)
|
||||
})
|
||||
|
||||
describe('Adapter: getAll()', () => {
|
||||
tests.getAll(it)
|
||||
})
|
||||
|
||||
describe('Adapter: create()', () => {
|
||||
tests.create(it)
|
||||
})
|
||||
|
||||
describe('Adapter: update()', () => {
|
||||
tests.update(it)
|
||||
})
|
||||
|
||||
describe('Adapter: delete()', () => {
|
||||
tests.delete(it)
|
||||
})
|
||||
|
||||
describe('Full CRUD Cycle', () => {
|
||||
tests.crudCycle(it)
|
||||
})
|
||||
1
test/test-notes/test-create-note.json
Normal file
1
test/test-notes/test-create-note.json
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-create-note","data":"test-data"}
|
||||
1
test/test-notes/test-create-note.md
Normal file
1
test/test-notes/test-create-note.md
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-create-note","data":"test-data"}
|
||||
1
test/test-notes/test-crud-cycle.md
Normal file
1
test/test-notes/test-crud-cycle.md
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-crud-cycle","data":"test-data"}
|
||||
1
test/test-notes/test-note-1.json
Normal file
1
test/test-notes/test-note-1.json
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-note-1","data":"test-data"}
|
||||
1
test/test-notes/test-note-1.md
Normal file
1
test/test-notes/test-note-1.md
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-note-1","data":"test-data"}
|
||||
1
test/test-notes/test-update-note-2.json
Normal file
1
test/test-notes/test-update-note-2.json
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-update-note-2","data":"Updated data v2"}
|
||||
1
test/test-notes/test-update-note-2.md
Normal file
1
test/test-notes/test-update-note-2.md
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-update-note-2","data":"Updated data v2"}
|
||||
1
test/test-notes/test-update-note.json
Normal file
1
test/test-notes/test-update-note.json
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-update-note","data":"Updated data"}
|
||||
1
test/test-notes/test-update-note.md
Normal file
1
test/test-notes/test-update-note.md
Normal file
@@ -0,0 +1 @@
|
||||
{"id":"test-update-note","data":"Updated data"}
|
||||
Reference in New Issue
Block a user