Include home relay in generated naddr
This commit is contained in:
parent
ce469bc37f
commit
a0f0b06ad2
@ -15,6 +15,10 @@ export default class Article {
|
||||
return tag ? tag[1] : "";
|
||||
}
|
||||
|
||||
get isDraft(): boolean {
|
||||
return this.event.kind === 30024;
|
||||
}
|
||||
|
||||
get url(): string {
|
||||
return `${config.base_url}/${this.naddr}`;
|
||||
}
|
||||
@ -47,6 +51,7 @@ export default class Article {
|
||||
identifier: this.identifier,
|
||||
pubkey: this.event.pubkey,
|
||||
kind: this.event.kind,
|
||||
relays: [config.home_relay_url],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,18 @@ describe("Article", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("#isDraft", () => {
|
||||
it("is false when kind is 30023", () => {
|
||||
expect(article.isDraft).toBe(false);
|
||||
});
|
||||
|
||||
it("is true when kind is 30024", () => {
|
||||
article.event.kind = 30024;
|
||||
expect(article.isDraft).toBe(true);
|
||||
article.event.kind = 30023;
|
||||
});
|
||||
});
|
||||
|
||||
describe("#title", () => {
|
||||
it("returns the content of the 'title' tag", () => {
|
||||
expect(article.title).toMatch(
|
||||
@ -53,9 +65,9 @@ describe("Article", () => {
|
||||
});
|
||||
|
||||
describe("#naddr", () => {
|
||||
it("returns bech32 addressable event ID", () => {
|
||||
expect(article.naddr).toEqual(
|
||||
"naddr1qvzqqqr4gupzq8meqkx80g3yuklzymy0qfx2ekk56aqc2ht4ak03z3em4r4cdcwtqqxnzdejxcenjd3hx5urgwp4676hkz",
|
||||
it("returns a bech32 addressable event ID", () => {
|
||||
expect(article.naddr).toMatch(
|
||||
/naddr1qvzqqqr4gupzq8meqkx80g3yuklzymy0qf/,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user