-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
Submodule nostr.ts
updated
6 files
+24 −0 | _helper.test.ts | |
+22 −6 | _helper.ts | |
+9 −0 | deno.lock | |
+19 −0 | deno.test.lock | |
+10 −3 | nostr.ts | |
+6 −5 | space-member.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ import { InMemoryAccountContext } from "../nostr.ts/nostr.ts"; | |
import { fail } from "https://deno.land/[email protected]/assert/fail.ts"; | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import { prepareAddMember } from "../nostr.ts/space-member.ts"; | ||
import { sleep } from "https://raw.githubusercontent.com/BlowaterNostr/csp/master/csp.ts"; | ||
|
||
const test_ctx = InMemoryAccountContext.Generate(); | ||
const test_kv = async () => { | ||
|
@@ -38,6 +37,18 @@ Deno.test("Space Member", async (t) => { | |
assertEquals(space_members.map((event) => event.id).includes(add_member_event.id), true); | ||
}); | ||
|
||
await t.step("it it already a member", async () => { | ||
const redo = await prepareAddMember(test_ctx, new_member.publicKey.hex); | ||
if (redo instanceof Error) fail(redo.message); | ||
const r = await fetch(`${relay.http_url}`, { | ||
method: "POST", | ||
body: JSON.stringify(redo), | ||
}); | ||
const message = await r.text(); | ||
assertEquals(r.status, 400); | ||
assertEquals(message, `${new_member.publicKey.hex} is already a member of the space.`); | ||
}); | ||
|
||
await t.step("admin is member", async () => { | ||
const res = await relay.is_space_member(test_ctx.publicKey.hex); | ||
if (res instanceof Error) fail(res.message); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters