mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 19:26:47 +02:00
Removing debug methods from the main binary
This commit is contained in:
@@ -56,11 +56,6 @@ open class Event(
|
||||
|
||||
fun toJson(): String = EventManualSerializer.toJson(id, pubKey, createdAt, kind, tags, content, sig)
|
||||
|
||||
/**
|
||||
* For debug purposes only
|
||||
*/
|
||||
fun toPrettyJson(): String = EventManualSerializer.toPrettyJson(id, pubKey, createdAt, kind, tags, content, sig)
|
||||
|
||||
companion object {
|
||||
fun fromJson(json: String): Event = EventMapper.fromJson(json)
|
||||
|
||||
|
@@ -26,7 +26,7 @@ import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||
|
||||
class EventManualSerializer {
|
||||
companion object {
|
||||
private fun assemble(
|
||||
fun assemble(
|
||||
id: HexKey,
|
||||
pubKey: HexKey,
|
||||
createdAt: Long,
|
||||
@@ -69,21 +69,5 @@ class EventManualSerializer {
|
||||
val obj = assemble(id, pubKey, createdAt, kind, tags, content, sig)
|
||||
return EventMapper.mapper.writeValueAsString(obj)
|
||||
}
|
||||
|
||||
/**
|
||||
* For debug purposes only
|
||||
*/
|
||||
fun toPrettyJson(
|
||||
id: HexKey,
|
||||
pubKey: HexKey,
|
||||
createdAt: Long,
|
||||
kind: Int,
|
||||
tags: Array<Array<String>>,
|
||||
content: String,
|
||||
sig: String,
|
||||
): String {
|
||||
val obj = assemble(id, pubKey, createdAt, kind, tags, content, sig)
|
||||
return EventMapper.mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,9 @@
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip01Core.metadata
|
||||
|
||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
import com.vitorpamplona.quartz.nip01Core.jackson.EventManualSerializer
|
||||
import com.vitorpamplona.quartz.nip01Core.jackson.EventMapper
|
||||
import com.vitorpamplona.quartz.utils.nsecToSigner
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
@@ -27,6 +30,14 @@ import org.junit.Test
|
||||
class UpdateMetadataTest {
|
||||
val signer = "nsec10g0wheggqn9dawlc0yuv6adnat6n09anr7eyykevw2dm8xa5fffs0wsdsr".nsecToSigner()
|
||||
|
||||
/**
|
||||
* For debug purposes only
|
||||
*/
|
||||
fun Event.toPrettyJson(): String {
|
||||
val obj = EventManualSerializer.assemble(id, pubKey, createdAt, kind, tags, content, sig)
|
||||
return EventMapper.mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun createNewMetadata() {
|
||||
val test = signer.sign(MetadataEvent.createNew("Vitor", createdAt = 1740669816))
|
||||
|
Reference in New Issue
Block a user