diff --git a/backend/src/db/factories.ts b/backend/src/db/factories.ts index 4ec34e289..c75c92fdd 100644 --- a/backend/src/db/factories.ts +++ b/backend/src/db/factories.ts @@ -49,7 +49,7 @@ Factory.define('badge') }) Factory.define('image') - .attr('url', faker.image.unsplash.imageUrl) + .attr('url', faker.image.url) .attr('aspectRatio', 1.3333333333333333) .attr('alt', faker.lorem.sentence) .attr('type', 'image/jpeg') @@ -63,7 +63,7 @@ Factory.define('basicUser') .option('password', '1234') .attrs({ id: uuid, - name: faker.name.fullName, + name: faker.person.fullName, password: '1234', role: 'user', termsAndConditionsAgreedVersion: '0.0.1', @@ -107,7 +107,7 @@ Factory.define('user') .option('email', faker.internet.exampleEmail) .option('avatar', () => Factory.build('image', { - url: faker.internet.avatar(), + url: faker.image.avatar(), }), ) .after(async (buildObject, options) => { diff --git a/backend/src/db/seed.ts b/backend/src/db/seed.ts index 53cd4cea6..bff236f64 100644 --- a/backend/src/db/seed.ts +++ b/backend/src/db/seed.ts @@ -632,7 +632,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat16'], author: peterLustig, image: Factory.build('image', { - url: faker.image.unsplash.food(300, 169), + url: faker.image.urlLoremFlickr({ category: 'food', width: 300, height: 169 }), sensitive: true, aspectRatio: 300 / 169, }), @@ -648,7 +648,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat1'], author: bobDerBaumeister, image: Factory.build('image', { - url: faker.image.unsplash.technology(300, 1500), + url: faker.image.urlLoremFlickr({ category: 'technics', width: 300, height: 1500 }), aspectRatio: 300 / 1500, }), }, @@ -696,7 +696,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat6'], author: peterLustig, image: Factory.build('image', { - url: faker.image.unsplash.buildings(300, 857), + url: faker.image.urlLoremFlickr({ category: 'city', width: 300, height: 857 }), aspectRatio: 300 / 857, }), }, @@ -735,7 +735,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat11'], author: louie, image: Factory.build('image', { - url: faker.image.unsplash.people(300, 901), + url: faker.image.urlLoremFlickr({ category: 'people', width: 300, height: 901 }), aspectRatio: 300 / 901, }), }, @@ -761,7 +761,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat14'], author: jennyRostock, image: Factory.build('image', { - url: faker.image.unsplash.objects(300, 200), + url: faker.image.urlLoremFlickr({ category: 'abstract', width: 300, height: 200 }), aspectRatio: 300 / 450, }), }, @@ -821,7 +821,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] mutation: createPostMutation(), variables: { id: 'p8', - image: faker.image.unsplash.nature(), + image: faker.image.urlLoremFlickr({ category: 'nature' }), title: `Quantum Flow Theory explains Quantum Gravity`, content: hashtagAndMention1, categoryIds: ['cat8'], @@ -1178,7 +1178,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat1'], author: jennyRostock, image: Factory.build('image', { - url: faker.image.unsplash.objects(), + url: faker.image.urlLoremFlickr({ category: 'abstract' }), }), }, ) @@ -1229,7 +1229,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat1'], author: peterLustig, image: Factory.build('image', { - url: faker.image.unsplash.buildings(), + url: faker.image.urlLoremFlickr({ category: 'city' }), }), }, ) @@ -1280,7 +1280,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat1'], author: dewey, image: Factory.build('image', { - url: faker.image.unsplash.food(), + url: faker.image.urlLoremFlickr({ category: 'food' }), }), }, ) @@ -1331,7 +1331,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat1'], author: louie, image: Factory.build('image', { - url: faker.image.unsplash.technology(), + url: faker.image.urlLoremFlickr({ category: 'technics' }), }), }, ) @@ -1382,7 +1382,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat1'], author: bobDerBaumeister, image: Factory.build('image', { - url: faker.image.unsplash.people(), + url: faker.image.urlLoremFlickr({ category: 'people' }), }), }, ) @@ -1433,7 +1433,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] categoryIds: ['cat1'], author: huey, image: Factory.build('image', { - url: faker.image.unsplash.nature(), + url: faker.image.urlLoremFlickr({ category: 'nature' }), }), }, ) diff --git a/webapp/components/CommentList/CommentList.story.js b/webapp/components/CommentList/CommentList.story.js index 50a2b1d1b..d0133ef8d 100644 --- a/webapp/components/CommentList/CommentList.story.js +++ b/webapp/components/CommentList/CommentList.story.js @@ -1,4 +1,4 @@ -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { storiesOf } from '@storybook/vue' import { withA11y } from '@storybook/addon-a11y' import HcCommentList from './CommentList.vue' @@ -8,7 +8,7 @@ helpers.init() const commentMock = (fields) => { return { - id: faker.random.uuid(), + id: faker.string.uuid(), title: faker.lorem.sentence(), content: faker.lorem.paragraph(), createdAt: faker.date.past(), diff --git a/webapp/components/_new/generic/TabNavigation/TabNavigator.story.js b/webapp/components/_new/generic/TabNavigation/TabNavigator.story.js index 6da7a5763..fcd4a067a 100644 --- a/webapp/components/_new/generic/TabNavigation/TabNavigator.story.js +++ b/webapp/components/_new/generic/TabNavigation/TabNavigator.story.js @@ -1,4 +1,4 @@ -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import { storiesOf } from '@storybook/vue' import { withA11y } from '@storybook/addon-a11y' import HcEmpty from '~/components/Empty/Empty' @@ -17,7 +17,7 @@ helpers.init() const postMock = (fields) => { return { ...post, - id: faker.random.uuid(), + id: faker.string.uuid(), createdAt: faker.date.past(), updatedAt: faker.date.recent(), deleted: false, @@ -30,7 +30,7 @@ const postMock = (fields) => { const userMock = (fields) => { return { ...user, - id: faker.random.uuid(), + id: faker.string.uuid(), createdAt: faker.date.past(), updatedAt: faker.date.recent(), deleted: false, diff --git a/webapp/package.json b/webapp/package.json index 3a9ac816d..ce954cf74 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -71,7 +71,7 @@ "@babel/core": "^7.24.4", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/preset-env": "^7.22.4", - "@faker-js/faker": "5.1.0", + "@faker-js/faker": "8.4.1", "@nuxtjs/composition-api": "0.32.0", "@storybook/addon-a11y": "^8.0.8", "@storybook/addon-actions": "^5.3.21", diff --git a/webapp/storybook/helpers.js b/webapp/storybook/helpers.js index bc42d5ac7..f389fc3f4 100644 --- a/webapp/storybook/helpers.js +++ b/webapp/storybook/helpers.js @@ -2,7 +2,7 @@ import Vue from 'vue' import Vuex from 'vuex' import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js' import Styleguide from '@human-connection/styleguide' -import faker from '@faker-js/faker' +import { faker } from '@faker-js/faker' import Filters from '~/plugins/vue-filters' import Directives from '~/plugins/vue-directives' import IziToast from '~/plugins/izi-toast' @@ -61,9 +61,9 @@ const helpers = { }, fakeUser(n) { return new Array(n || 1).fill(0).map(() => { - const name = faker.name.findName() + const name = faker.person.fullName() return { - id: faker.random.uuid(), + id: faker.string.uuid(), name, slug: faker.helpers.slugify(name), } @@ -74,14 +74,14 @@ const helpers = { const title = faker.lorem.words() const content = faker.lorem.paragraph() return { - id: faker.random.uuid(), + id: faker.string.uuid(), title, content, - slug: faker.lorem.slug(title), - shoutedCount: faker.random.number(), - commentsCount: faker.random.number(), - clickedCount: faker.random.number(), - viewedTeaserCount: faker.random.number(), + slug: faker.lorem.slug({ min: 1, max: 3 }, title), + shoutedCount: faker.number.int(), + commentsCount: faker.number.int(), + clickedCount: faker.number.int(), + viewedTeaserCount: faker.number.int(), postType: ['Article'], } }) diff --git a/webapp/yarn.lock b/webapp/yarn.lock index 8bbf2a285..e67a90f7b 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -2270,10 +2270,10 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@faker-js/faker@5.1.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-5.1.0.tgz#cee1d77ada0d0dbbe77201d18b1ebabf432d9c0f" - integrity sha512-0VonSKh7fBCqvY+V2FLN2ZW4pR4ZtWJalWmwSaiaB7yK7y4qp8vDfuaq9QdLjf/cdZGx3M7Wc4Q+x4fZHxI21Q== +"@faker-js/faker@8.4.1": + version "8.4.1" + resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-8.4.1.tgz#5d5e8aee8fce48f5e189bf730ebd1f758f491451" + integrity sha512-XQ3cU+Q8Uqmrbf2e0cIC/QN43sTBSC8KF12u29Mb47tWrt2hAgBXSgpZMj4Ao8Uk0iJcU99QsOCaIL8934obCg== "@hapi/address@2.x.x": version "2.0.0"