-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
includeContentHashtags
only including last hashtag
- Loading branch information
Showing
9 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"applesauce-factory": patch | ||
--- | ||
|
||
Fix replaceable loader mixing parameterized replaceable and replaceable pointers |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"applesauce-factory": patch | ||
--- | ||
|
||
Fix `includeContentHashtags` only including last hashtag |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { includeContentHashtags, includeHashtags } from "./hashtags.js"; | ||
import { unixNow } from "applesauce-core/helpers"; | ||
|
||
describe("hashtags helpers", () => { | ||
describe("includeContentHashtags", () => { | ||
it("should include all content hashtags", () => { | ||
expect( | ||
includeContentHashtags()( | ||
{ content: "hello world #growNostr #nostr", created_at: unixNow(), tags: [], kind: 1 }, | ||
{}, | ||
), | ||
).toEqual( | ||
expect.objectContaining({ | ||
tags: [ | ||
["t", "grownostr"], | ||
["t", "nostr"], | ||
], | ||
}), | ||
); | ||
}); | ||
}); | ||
|
||
describe("includeHashtags", () => { | ||
it("should include all hashtags", () => { | ||
expect( | ||
includeHashtags(["nostr", "growNostr"])( | ||
{ content: "hello world", created_at: unixNow(), tags: [], kind: 1 }, | ||
{}, | ||
), | ||
).toEqual( | ||
expect.objectContaining({ | ||
tags: [ | ||
["t", "nostr"], | ||
["t", "grownostr"], | ||
], | ||
}), | ||
); | ||
}); | ||
}); | ||
}); |
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { describe, it, expect } from "vitest"; | ||
import { createFiltersFromAddressPointers } from "./address-pointer.js"; | ||
import { kinds } from "nostr-tools"; | ||
|
||
describe("address pointer helpers", () => { | ||
describe("createFiltersFromAddressPointers", () => { | ||
it("should separate replaceable and parameterized replaceable pointers", () => { | ||
expect( | ||
createFiltersFromAddressPointers([ | ||
{ kind: kinds.BookmarkList, pubkey: "pubkey" }, | ||
{ kind: kinds.Metadata, pubkey: "pubkey" }, | ||
{ kind: kinds.Metadata, pubkey: "pubkey2" }, | ||
{ kind: kinds.Bookmarksets, identifier: "funny", pubkey: "pubkey" }, | ||
]), | ||
).toEqual( | ||
expect.arrayContaining([ | ||
{ kinds: [kinds.Metadata], authors: ["pubkey", "pubkey2"] }, | ||
{ kinds: [kinds.BookmarkList], authors: ["pubkey"] }, | ||
{ "#d": ["funny"], authors: ["pubkey"], kinds: [kinds.Bookmarksets] }, | ||
]), | ||
); | ||
}); | ||
}); | ||
}); |
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