nostr
package: more tests
#434
@ -1,7 +0,0 @@
|
|||||||
Allows the relay to be shut down with an HTTP request, after which
|
|
||||||
docker-compose will restart it. This allows each test to have a clean
|
|
||||||
slate. The drawback is that the tests can't run in parallel, so the
|
|
||||||
test suite is very slow. A better option would be to have this relay
|
|
||||||
server manage the relay completely: star/stop isolated relay instances
|
|
||||||
with HTTP requests and allow multiple instances to run at the same
|
|
||||||
time so that the tests can be parallelized.
|
|
@ -1,3 +1,4 @@
|
|||||||
[authorization]
|
[authorization]
|
||||||
nip42_auth = true
|
nip42_auth = true
|
||||||
|
# This seems to have no effect.
|
||||||
nip42_dms = true
|
nip42_dms = true
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Allows the relay to be shut down with an HTTP request, after which
|
||||||
|
* docker-compose will restart it. This allows each test to have a clean
|
||||||
|
* slate. The drawback is that the tests can't run in parallel, so the
|
||||||
|
* test suite is very slow. A better option would be to have this relay
|
||||||
|
* server manage the relay completely: star/stop isolated relay instances
|
||||||
|
* with HTTP requests and allow multiple instances to run at the same
|
||||||
|
* time so that the tests can be parallelized.
|
||||||
|
*/
|
||||||
|
|
||||||
import http from "node:http"
|
import http from "node:http"
|
||||||
import { spawn } from "node:child_process"
|
import { spawn } from "node:child_process"
|
||||||
|
|
||||||
|
@ -161,8 +161,7 @@ export class EventEmitter extends Base {
|
|||||||
// emitter[Symbol.for('nodejs.rejection')](err, eventName[, ...args]) shenanigans?
|
// emitter[Symbol.for('nodejs.rejection')](err, eventName[, ...args]) shenanigans?
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Add an open event
|
// TODO Refactor the params to be a single interface
|
||||||
// TODO Refactor the params
|
|
||||||
type EventName =
|
type EventName =
|
||||||
| "newListener"
|
| "newListener"
|
||||||
| "removeListener"
|
| "removeListener"
|
||||||
|
@ -166,6 +166,7 @@ export function createSetMetadata(
|
|||||||
// Perhaps the best option is for all these factory methods to have an overload which also accept a private
|
// Perhaps the best option is for all these factory methods to have an overload which also accept a private
|
||||||
// key as last parameter and return the event already signed, whereas for this method that would be
|
// key as last parameter and return the event already signed, whereas for this method that would be
|
||||||
// mandatory
|
// mandatory
|
||||||
|
// E.g. opts: { sign?: boolean | HexOrBechPrivateKey } setting sign to true should use nip07
|
||||||
export async function createDirectMessage({
|
export async function createDirectMessage({
|
||||||
message,
|
message,
|
||||||
recipient,
|
recipient,
|
||||||
|
@ -6,8 +6,8 @@ import { setup } from "./setup"
|
|||||||
describe("text note", async function () {
|
describe("text note", async function () {
|
||||||
const note = "hello world"
|
const note = "hello world"
|
||||||
|
|
||||||
it("publish and receive", (done) => {
|
|
||||||
// Test that a text note can be published by one client and received by the other.
|
// Test that a text note can be published by one client and received by the other.
|
||||||
|
it("publish and receive", (done) => {
|
||||||
setup(done).then(
|
setup(done).then(
|
||||||
({
|
({
|
||||||
publisher,
|
publisher,
|
||||||
@ -51,8 +51,8 @@ describe("text note", async function () {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("publish and ok", function (done) {
|
|
||||||
// Test that a client interprets an "OK" message after publishing a text note.
|
// Test that a client interprets an "OK" message after publishing a text note.
|
||||||
|
it("publish and ok", function (done) {
|
||||||
setup(done).then(({ publisher, subscriber, publisherSecret, url }) => {
|
setup(done).then(({ publisher, subscriber, publisherSecret, url }) => {
|
||||||
// TODO No signEvent, have a convenient way to do this
|
// TODO No signEvent, have a convenient way to do this
|
||||||
signEvent(createTextNote(note), publisherSecret).then((event) => {
|
signEvent(createTextNote(note), publisherSecret).then((event) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user