|
| 1 | +import { faker } from "@faker-js/faker"; |
| 2 | +import type { Discussion } from "@hiveio/dhive"; |
| 3 | + |
| 4 | +export function fakeDiscussion(): Discussion { |
| 5 | + return { |
| 6 | + abs_rshares: "", |
| 7 | + active: "", |
| 8 | + active_votes: [], |
| 9 | + allow_curation_rewards: false, |
| 10 | + allow_replies: false, |
| 11 | + allow_votes: false, |
| 12 | + author: faker.internet.username(), |
| 13 | + author_reputation: 0, |
| 14 | + author_rewards: "", |
| 15 | + beneficiaries: [], |
| 16 | + body: faker.lorem.paragraphs(2), |
| 17 | + body_length: "", |
| 18 | + cashout_time: "", |
| 19 | + category: faker.lorem.word(), |
| 20 | + children: 0, |
| 21 | + children_abs_rshares: "", |
| 22 | + created: "", |
| 23 | + curator_payout_value: "", |
| 24 | + depth: 0, |
| 25 | + post_id: faker.number.int(), |
| 26 | + // @ts-expect-error It actually comes in as an object, not string |
| 27 | + json_metadata: { |
| 28 | + app: faker.internet.jwt(), |
| 29 | + description: faker.lorem.sentences(2), |
| 30 | + format: "markdown+html", |
| 31 | + tags: faker.lorem.words(5).split(" "), |
| 32 | + image: faker.helpers.multiple(() => faker.image.url(), { |
| 33 | + count: { min: 0, max: 5 } |
| 34 | + }) |
| 35 | + }, |
| 36 | + last_payout: "", |
| 37 | + last_update: "", |
| 38 | + max_accepted_payout: "", |
| 39 | + max_cashout_time: "", |
| 40 | + net_rshares: "", |
| 41 | + net_votes: 0, |
| 42 | + parent_author: "", |
| 43 | + parent_permlink: "", |
| 44 | + pending_payout_value: "", |
| 45 | + percent_hbd: 0, |
| 46 | + permlink: faker.internet.url(), |
| 47 | + promoted: "", |
| 48 | + reblogged_by: [], |
| 49 | + replies: [], |
| 50 | + reward_weight: 0, |
| 51 | + root_comment: 0, |
| 52 | + root_title: "", |
| 53 | + title: faker.lorem.words(5), |
| 54 | + total_payout_value: "", |
| 55 | + total_pending_payout_value: "", |
| 56 | + total_vote_weight: 0, |
| 57 | + url: faker.internet.url(), |
| 58 | + vote_rshares: "", |
| 59 | + community: `hive-${faker.number.int()}`, |
| 60 | + community_title: faker.lorem.words(2) |
| 61 | + }; |
| 62 | +} |
| 63 | + |
| 64 | +// export function fakePost(): Post { |
| 65 | +// const created = faker.date.past(); |
| 66 | +// |
| 67 | +// return { |
| 68 | +// id: faker.number.int().toString(), |
| 69 | +// canonical: faker.internet.url(), |
| 70 | +// category: faker.lorem.word(), |
| 71 | +// content: faker.lorem.paragraphs(2), |
| 72 | +// created: created, |
| 73 | +// updated: faker.date.past({ refDate: created }), |
| 74 | +// description: faker.lorem.sentences(2), |
| 75 | +// meta: { app: faker.internet.jwt(), format: "markdown+html" }, |
| 76 | +// tags: faker.lorem.words(5).split(" "), |
| 77 | +// title: faker.lorem.words(5), |
| 78 | +// author: faker.internet.username(), |
| 79 | +// image: faker.image.url() |
| 80 | +// }; |
| 81 | +// } |
0 commit comments