Clean up domain a bit
tests / tests (push) Failing after 5m5s

This commit is contained in:
Jon Staab
2026-06-18 12:49:13 -07:00
parent 0a08057786
commit 925f540640
6 changed files with 154 additions and 190 deletions
+5 -5
View File
@@ -12,7 +12,7 @@ const c = "cc".repeat(32)
describe("MuteList", () => {
it("round-trips public and private mutes through encryption", async () => {
const list = MuteList.make().addPublicly(a).addPrivately(b)
const list = MuteList.init().addPublicly(a).addPrivately(b)
expect(list.pubkeys.sort()).toEqual([a, b].sort())
expect(list.includes(a)).toBe(true)
@@ -41,7 +41,7 @@ describe("MuteList", () => {
})
it("removes from both public and private entries", async () => {
const list = MuteList.make().addPublicly(a).addPrivately(b)
const list = MuteList.init().addPublicly(a).addPrivately(b)
list.remove(a)
list.remove(b)
@@ -50,7 +50,7 @@ describe("MuteList", () => {
})
it("preserves undecrypted ciphertext on pass-through serialization", async () => {
const event = await MuteList.make().addPrivately(b).toEvent(signer)
const event = await MuteList.init().addPrivately(b).toEvent(signer)
const undecrypted = await MuteList.parse(event)
// We never decrypted, so the original ciphertext must survive untouched.
@@ -60,14 +60,14 @@ describe("MuteList", () => {
})
it("refuses private mutation when undecrypted", async () => {
const event = await MuteList.make().addPrivately(b).toEvent(signer)
const event = await MuteList.init().addPrivately(b).toEvent(signer)
const undecrypted = await MuteList.parse(event)
expect(() => undecrypted.addPrivately(c)).toThrow()
})
it("toRumor encrypts but does not sign", async () => {
const rumor = await MuteList.make().addPrivately(b).toRumor(signer)
const rumor = await MuteList.init().addPrivately(b).toRumor(signer)
expect(rumor.id).toBeTruthy()
expect((rumor as TrustedEvent).sig).toBeUndefined()
+11 -11
View File
@@ -26,7 +26,7 @@ describe("Profile", () => {
tags: [["alt", "profile"]],
})
const profile = Profile.parse(event)
const profile = await Profile.parse(event)
expect(profile.values.name).toBe("alice")
expect(profile.hasName()).toBe(true)
@@ -41,27 +41,27 @@ describe("Profile", () => {
})
it("derives lnurl from a lud16 address", () => {
const profile = Profile.make({lud16: "alice@example.com"})
const profile = Profile.init({lud16: "alice@example.com"})
expect(profile.values.lnurl).toBeTruthy()
})
it("set merges and re-derives values", () => {
const profile = Profile.make({name: "alice"})
it("gets and sets values by key", () => {
const profile = Profile.init({name: "alice"})
profile.set({about: "hello"})
profile.set("about", "hello")
expect(profile.values.name).toBe("alice")
expect(profile.values.about).toBe("hello")
expect(profile.get("name")).toBe("alice")
expect(profile.get("about")).toBe("hello")
})
it("display falls back to a shortened npub", () => {
const profile = Profile.parse(makeEvent({content: "{}"}))
it("display falls back to a shortened npub", async () => {
const profile = await Profile.parse(makeEvent({content: "{}"}))
expect(profile.display()).toBe(displayPubkey(pubkey))
})
it("throws on the wrong kind", () => {
expect(() => Profile.parse(makeEvent({kind: NOTE}))).toThrow()
it("throws on the wrong kind", async () => {
await expect(Profile.parse(makeEvent({kind: NOTE}))).rejects.toThrow()
})
})