Skip to content

Commit

Permalink
update faker usage
Browse files Browse the repository at this point in the history
  • Loading branch information
danieltott committed Oct 2, 2024
1 parent cf6ec2f commit b5d4860
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/data/mocks/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export function createEventsData({
rangeStart: string;
rangeEnd: string;
}) {
const dates = faker.date.betweens(rangeStart, rangeEnd, limit);
const dates = faker.date.betweens({
from: rangeStart,
to: rangeEnd,
count: limit,
});

return dates.map((date) => {
const startDate = DateTime.fromJSDate(date);
Expand All @@ -23,7 +27,7 @@ export function createEventsData({
});

return {
id: faker.datatype.uuid(),
id: faker.string.uuid(),
title: faker.lorem.sentence(7),
startDateLocalized: startDate.toUTC().toString(),
endDateLocalized: startDate.toUTC().plus({ hours: 1 }).toString(),
Expand Down
2 changes: 1 addition & 1 deletion src/data/mocks/memberData.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/data/mocks/podcast.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export function getEpisodes({ limit = 5 }) {
return new Array(limit).fill(null).map((_, i) => {
const episode = limit - i;
const season = 1;
const name = faker.name.fullName();
const name = faker.person.fullName();

return {
title: `${name} - ${faker.lorem.words(4)}`,
slug: `0${season}${episode < 10 ? '0' + episode : episode}-${slugify(
name,
)}`,
id: faker.datatype.uuid(),
id: faker.string.uuid(),
metaDescription: `Season ${season}, Episode ${episode} of the Virtual Coffee Podcast`,
podcastEpisode: episode,
podcastSeason: season,
Expand All @@ -29,7 +29,7 @@ export function getEpisodes({ limit = 5 }) {

export function getEpisode({ slug }: { slug: PodcastEpisode['slug'] }) {
const today = DateTime.now();
const name = faker.name.fullName();
const name = faker.person.fullName();
const season = parseInt(slug.slice(0, 2));
const episode = parseInt(slug.slice(2, 4));

Expand All @@ -38,7 +38,7 @@ export function getEpisode({ slug }: { slug: PodcastEpisode['slug'] }) {
slug: `0${season}${episode < 10 ? '0' + episode : episode}-${slugify(
name,
)}`,
id: faker.datatype.uuid(),
id: faker.string.uuid(),
metaDescription: `Season ${season}, Episode ${episode} of the Virtual Coffee Podcast`,
podcastEpisode: episode,
podcastSeason: season,
Expand All @@ -52,7 +52,7 @@ export function getEpisode({ slug }: { slug: PodcastEpisode['slug'] }) {
},
podcastGuests: [
{
id: faker.datatype.uuid(),
id: faker.string.uuid(),
guestName: name,
guestBio: {
renderHtml: `<p>${faker.lorem.sentence()}</p>`,
Expand Down

0 comments on commit b5d4860

Please sign in to comment.