Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions helpers/fixtures/jf2/photo-untitled.jf2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "entry",
"photo": [
"https://foo.bar/qux.jpg"
],
"url": "https://foo.bar/lunchtime"
}
2 changes: 1 addition & 1 deletion packages/syndicator-bluesky/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const uriToPostUrl = (profileUrl, uri) => {
* @returns {string} Post text
*/
export const getPostText = (properties, includePermalink) => {
let text;
let text = "";

if (properties.name && properties.name !== "") {
// Post has a non-empty title, show title with a link to post
Expand Down
8 changes: 8 additions & 0 deletions packages/syndicator-bluesky/test/unit/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ describe("syndicator-bluesky/lib/utils", () => {
});
});

it("Gets post text for post with no content", () => {
const result = getPostText(
JSON.parse(getFixture("jf2/photo-untitled.jf2")),
);

assert.equal(result, "");
});

it("Gets post text with article post name and URL", () => {
const result = getPostText(
JSON.parse(getFixture("jf2/article-content-provided-html-text.jf2")),
Expand Down
Loading