more tests

This commit is contained in:
Ticruz
2025-02-04 13:21:23 +01:00
committed by Jon Staab
parent 8c638a7d8f
commit 23f7244039
14 changed files with 83 additions and 80 deletions
+1
View File
@@ -141,6 +141,7 @@ export const closeStorage = async () => {
export const clearStorage = async () => {
await closeStorage()
await deleteDB(db.name)
db = undefined // force initStorage to run again
}
const migrate = (data: any[], options: StorageAdapterOptions) =>
+16 -2
View File
@@ -185,16 +185,30 @@ thunkWorker.addGlobalHandler((thunk: Thunk) => {
// Avoid making this function async so multiple publishes can run concurrently
Promise.resolve().then(async () => {
const fail = (message: string) => {
const status = new Map<string, ThunkStatus>()
for (const url of thunk.request.relays) {
status.set(url, {status: PublishStatus.Failed, message})
}
thunk.status.set(status)
}
// If the event was already signed, leave it alone. Otherwise, sign it now. This is to
// decrease apparent latency in the UI that results from waiting for remote signers
if (!isSignedEvent(event)) {
const signer = getSigner(getSession(event.pubkey))
if (!signer) {
return console.warn(`No signer found for ${event.pubkey}`)
return fail(`No signer found for ${event.pubkey}`)
}
event = await signer.sign(event)
try {
event = await signer.sign(event)
} catch (e) {
return fail(e.toString())
}
}
// We're guaranteed to have a signed event at this point