From eedfb0490fa80383938c5bbb7989aa71e5918844 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Mon, 24 Jul 2023 21:59:32 -0400 Subject: [PATCH] chore: update faker functions (2) --- .../app/web/statics/embed/app.placeholder.js | 18 +++++++------- tests/mocks/api/axios/get/lastfm.mjs | 24 +++++++++---------- tests/mocks/api/axios/get/pagespeed.mjs | 12 +++++----- tests/mocks/api/axios/get/spotify.mjs | 18 +++++++------- tests/mocks/api/axios/post/leetcode.mjs | 6 ++--- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/source/app/web/statics/embed/app.placeholder.js b/source/app/web/statics/embed/app.placeholder.js index 4018f332434..130c093ac91 100644 --- a/source/app/web/statics/embed/app.placeholder.js +++ b/source/app/web/statics/embed/app.placeholder.js @@ -91,7 +91,7 @@ forks: faker.number.int(1000), releases: faker.number.int(1000), }, - diskUsage: `${faker.datatype.float({min: 1, max: 999}).toFixed(1)}MB`, + diskUsage: `${faker.number.float({min: 1, max: 999}).toFixed(1)}MB`, registration: `${faker.number.int({min: 2, max: 10})} years ago`, cakeday: false, calendar: new Array(14).fill(null).map(_ => ({color: faker.helpers.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])})), @@ -274,7 +274,7 @@ ? { user: { commits: faker.number.int(100), - percentage: faker.datatype.float({max: 1}), + percentage: faker.number.float({max: 1}), maintainer: false, stars: faker.number.int(100), }, @@ -679,10 +679,10 @@ url: options["pagespeed.url"] || "(attached website url)", detailed: options["pagespeed.detailed"] || false, scores: [ - {score: faker.datatype.float({max: 1}), title: "Performance"}, - {score: faker.datatype.float({max: 1}), title: "Accessibility"}, - {score: faker.datatype.float({max: 1}), title: "Best Practices"}, - {score: faker.datatype.float({max: 1}), title: "SEO"}, + {score: faker.number.float({max: 1}), title: "Performance"}, + {score: faker.number.float({max: 1}), title: "Accessibility"}, + {score: faker.number.float({max: 1}), title: "Best Practices"}, + {score: faker.number.float({max: 1}), title: "SEO"}, ...options["pagespeed.pwa"] ? [{score: faker.number.int({max: 1}), title: "PWA"}] : [], ], metrics: { @@ -695,12 +695,12 @@ maxPotentialFID: faker.number.int(500), observedLoad: faker.number.int(500), firstMeaningfulPaint: faker.number.int(500), - observedCumulativeLayoutShift: faker.datatype.float({max: 1}), + observedCumulativeLayoutShift: faker.number.float({max: 1}), observedSpeedIndex: faker.number.int(1000), observedSpeedIndexTs: faker.date.recent(), observedTimeOriginTs: faker.date.recent(), observedLargestContentfulPaint: faker.number.int(1000), - cumulativeLayoutShift: faker.datatype.float({max: 1}), + cumulativeLayoutShift: faker.number.float({max: 1}), observedFirstPaintTs: faker.date.recent(), observedTraceEndTs: faker.date.recent(), largestContentfulPaint: faker.number.int(2000), @@ -1326,7 +1326,7 @@ isocalendar: { streak: {max: 30 + faker.number.int(20), current: faker.number.int(30)}, max: 10 + faker.number.int(40), - average: faker.datatype.float(10), + average: faker.number.float(10), svg: await staticPlaceholder(set.plugins.enabled.isocalendar, `isocalendar.${options["isocalendar.duration"]}.svg`), duration: options["isocalendar.duration"], }, diff --git a/tests/mocks/api/axios/get/lastfm.mjs b/tests/mocks/api/axios/get/lastfm.mjs index 36360b50a11..ad301c6d5b1 100644 --- a/tests/mocks/api/axios/get/lastfm.mjs +++ b/tests/mocks/api/axios/get/lastfm.mjs @@ -33,19 +33,19 @@ export default function({faker, url, options, login = faker.internet.userName()} image: [ { size: "small", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "medium", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "large", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "extralarge", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, ], streamable: "0", @@ -86,19 +86,19 @@ export default function({faker, url, options, login = faker.internet.userName()} image: [ { size: "small", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "medium", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "large", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "extralarge", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, ], url: faker.internet.url(), @@ -130,19 +130,19 @@ export default function({faker, url, options, login = faker.internet.userName()} image: [ { size: "small", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "medium", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "large", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, { size: "extralarge", - "#text": faker.image.abstract(), + "#text": faker.image.urlLoremFlickr({ category: 'abstract' }), }, ], streamable: "0", diff --git a/tests/mocks/api/axios/get/pagespeed.mjs b/tests/mocks/api/axios/get/pagespeed.mjs index c958954e32d..0af64c04664 100644 --- a/tests/mocks/api/axios/get/pagespeed.mjs +++ b/tests/mocks/api/axios/get/pagespeed.mjs @@ -43,12 +43,12 @@ export default function({faker, url, options, login = faker.internet.userName()} maxPotentialFID: faker.number.int(500), observedLoad: faker.number.int(500), firstMeaningfulPaint: faker.number.int(500), - observedCumulativeLayoutShift: faker.datatype.float({max: 1}), + observedCumulativeLayoutShift: faker.number.float({max: 1}), observedSpeedIndex: faker.number.int(1000), observedSpeedIndexTs: faker.date.recent(), observedTimeOriginTs: faker.date.recent(), observedLargestContentfulPaint: faker.number.int(1000), - cumulativeLayoutShift: faker.datatype.float({max: 1}), + cumulativeLayoutShift: faker.number.float({max: 1}), observedFirstPaintTs: faker.date.recent(), observedTraceEndTs: faker.date.recent(), largestContentfulPaint: faker.number.int(2000), @@ -78,22 +78,22 @@ export default function({faker, url, options, login = faker.internet.userName()} "best-practices": { id: "best-practices", title: "Best Practices", - score: faker.datatype.float({max: 1}), + score: faker.number.float({max: 1}), }, seo: { id: "seo", title: "SEO", - score: faker.datatype.float({max: 1}), + score: faker.number.float({max: 1}), }, accessibility: { id: "accessibility", title: "Accessibility", - score: faker.datatype.float({max: 1}), + score: faker.number.float({max: 1}), }, performance: { id: "performance", title: "Performance", - score: faker.datatype.float({max: 1}), + score: faker.number.float({max: 1}), }, pwa: { id: "pwa", diff --git a/tests/mocks/api/axios/get/spotify.mjs b/tests/mocks/api/axios/get/spotify.mjs index 1519754ba8b..640726f1508 100644 --- a/tests/mocks/api/axios/get/spotify.mjs +++ b/tests/mocks/api/axios/get/spotify.mjs @@ -24,17 +24,17 @@ export default function({faker, url, options, login = faker.internet.userName()} images: [ { height: 640, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 640, }, { height: 300, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 300, }, { height: 64, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 64, }, ], @@ -81,17 +81,17 @@ export default function({faker, url, options, login = faker.internet.userName()} images: [ { height: 640, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 640, }, { height: 300, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 300, }, { height: 64, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 64, }, ], @@ -126,17 +126,17 @@ export default function({faker, url, options, login = faker.internet.userName()} images: [ { height: 640, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 640, }, { height: 300, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 300, }, { height: 64, - url: faker.image.abstract(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), width: 64, }, ], diff --git a/tests/mocks/api/axios/post/leetcode.mjs b/tests/mocks/api/axios/post/leetcode.mjs index 5b4c8c3bca1..3861fae7c89 100644 --- a/tests/mocks/api/axios/post/leetcode.mjs +++ b/tests/mocks/api/axios/post/leetcode.mjs @@ -64,9 +64,9 @@ export default function({faker, url, body, login = faker.internet.userName()}) { ], matchedUser: { problemsSolvedBeatsStats: [ - {difficulty: "Easy", percentage: faker.datatype.float({max: 100})}, - {difficulty: "Medium", percentage: faker.datatype.float({max: 100})}, - {difficulty: "Hard", percentage: faker.datatype.float({max: 100})}, + {difficulty: "Easy", percentage: faker.number.float({max: 100})}, + {difficulty: "Medium", percentage: faker.number.float({max: 100})}, + {difficulty: "Hard", percentage: faker.number.float({max: 100})}, ], submitStatsGlobal: { acSubmissionNum: [