Fix cashu tests

This commit is contained in:
Alex Gleason 2025-02-15 18:51:15 -06:00
parent d0d37f5948
commit 3073777d9b
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -1,3 +1,4 @@
import { confMw } from '@ditto/api/middleware';
import { Env as HonoEnv, Hono } from '@hono/hono'; import { Env as HonoEnv, Hono } from '@hono/hono';
import { NostrSigner, NSecSigner, NStore } from '@nostrify/nostrify'; import { NostrSigner, NSecSigner, NStore } from '@nostrify/nostrify';
import { generateSecretKey, getPublicKey } from 'nostr-tools'; import { generateSecretKey, getPublicKey } from 'nostr-tools';
@ -40,7 +41,10 @@ Deno.test('PUT /wallet must be successful', {
c.set('store', store); c.set('store', store);
await next(); await next();
}, },
).route('/', cashuApp); );
app.use(confMw(new Map()));
app.route('/', cashuApp);
const response = await app.request('/wallet', { const response = await app.request('/wallet', {
method: 'PUT', method: 'PUT',
@ -116,7 +120,10 @@ Deno.test('PUT /wallet must NOT be successful: wrong request body/schema', async
c.set('store', store); c.set('store', store);
await next(); await next();
}, },
).route('/', cashuApp); );
app.use(confMw(new Map()));
app.route('/', cashuApp);
const response = await app.request('/wallet', { const response = await app.request('/wallet', {
method: 'PUT', method: 'PUT',
@ -149,7 +156,10 @@ Deno.test('PUT /wallet must NOT be successful: wallet already exists', async ()
c.set('store', store); c.set('store', store);
await next(); await next();
}, },
).route('/', cashuApp); );
app.use(confMw(new Map()));
app.route('/', cashuApp);
await db.store.event(genEvent({ kind: 17375 }, sk)); await db.store.event(genEvent({ kind: 17375 }, sk));
@ -187,7 +197,10 @@ Deno.test('GET /wallet must be successful', async () => {
c.set('store', store); c.set('store', store);
await next(); await next();
}, },
).route('/', cashuApp); );
app.use(confMw(new Map()));
app.route('/', cashuApp);
// Wallet // Wallet
await db.store.event(genEvent({ await db.store.event(genEvent({
@ -290,7 +303,10 @@ Deno.test('GET /mints must be successful', async () => {
c.set('store', store); c.set('store', store);
await next(); await next();
}, },
).route('/', cashuApp); );
app.use(confMw(new Map()));
app.route('/', cashuApp);
const response = await app.request('/mints', { const response = await app.request('/mints', {
method: 'GET', method: 'GET',