|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import { expect, test } from 'bun:test'
|
|
|
|
|
import path from 'path'
|
|
|
|
|
|
|
|
|
|
import ItemStore from './../resources/itemStore.ts'
|
|
|
|
|
import runMigrationSqlite from './../src/migration.ts'
|
|
|
|
@ -14,7 +15,7 @@ test('store', () => {
|
|
|
|
|
test('store / insert', async () => {
|
|
|
|
|
const db = getOrCreateSqlite({ 'uri': ':memory:' })
|
|
|
|
|
|
|
|
|
|
await runMigrationSqlite('./../resources', db)
|
|
|
|
|
await runMigrationSqlite(path.join(__dirname, './../resources'), db)
|
|
|
|
|
const itemStore = new ItemStore(db)
|
|
|
|
|
|
|
|
|
|
const id = itemStore.create({ 'name': 'Lorem ipsum dolor', 'description': 'lore' })
|
|
|
|
@ -26,7 +27,7 @@ test('store / insert', async () => {
|
|
|
|
|
test('store / remove', async () => {
|
|
|
|
|
const db = getOrCreateSqlite({ 'uri': ':memory:' })
|
|
|
|
|
|
|
|
|
|
await runMigrationSqlite('./../resources', db)
|
|
|
|
|
await runMigrationSqlite(path.join(__dirname, './../resources'), db)
|
|
|
|
|
const itemStore = new ItemStore(db)
|
|
|
|
|
|
|
|
|
|
itemStore.create({ 'name': 'Lorem ipsum dolor', 'description': 'lore' })
|
|
|
|
@ -41,7 +42,7 @@ test('store / remove', async () => {
|
|
|
|
|
test('store / update', async () => {
|
|
|
|
|
const db = getOrCreateSqlite({ 'uri': ':memory:' })
|
|
|
|
|
|
|
|
|
|
await runMigrationSqlite('./../resources', db)
|
|
|
|
|
await runMigrationSqlite(path.join(__dirname, './../resources'), db)
|
|
|
|
|
const itemStore = new ItemStore(db)
|
|
|
|
|
|
|
|
|
|
const id = itemStore.create({ 'name': 'Lorem ipsum dolor', 'description': 'lore' })
|
|
|
|
|