From 740506aadc4f64be6f0d641e98ede76c8e1c5afa Mon Sep 17 00:00:00 2001 From: thomashohn Date: Thu, 14 Nov 2024 10:06:10 +0100 Subject: [PATCH] Replace deprecated faker.name with faker.person (#4581) --- docs/data.md | 4 ++-- docs/helpers/ApiDataFactory.md | 2 +- docs/helpers/GraphQLDataFactory.md | 2 +- lib/helper/ApiDataFactory.js | 2 +- lib/helper/GraphQLDataFactory.js | 2 +- test/data/graphql/users_factory.js | 2 +- test/data/rest/posts_factory.js | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/data.md b/docs/data.md index da91d05c6..6c8bc4288 100644 --- a/docs/data.md +++ b/docs/data.md @@ -211,7 +211,7 @@ var Factory = require('rosie').Factory; var faker = require('@faker-js/faker'); module.exports = new Factory() - .attr('name', () => faker.name.findName()) + .attr('name', () => faker.person.findName()) .attr('email', () => faker.internet.email()); ``` @@ -271,7 +271,7 @@ module.exports = new Factory((buildObj) => { input: { ...buildObj }, } }) - .attr('name', () => faker.name.findName()) + .attr('name', () => faker.person.findName()) .attr('email', () => faker.internet.email()); ``` diff --git a/docs/helpers/ApiDataFactory.md b/docs/helpers/ApiDataFactory.md index 2e25d1636..0be0039a6 100644 --- a/docs/helpers/ApiDataFactory.md +++ b/docs/helpers/ApiDataFactory.md @@ -58,7 +58,7 @@ const { faker } = require('@faker-js/faker'); module.exports = new Factory() // no need to set id, it will be set by REST API - .attr('author', () => faker.name.findName()) + .attr('author', () => faker.person.findName()) .attr('title', () => faker.lorem.sentence()) .attr('body', () => faker.lorem.paragraph()); ``` diff --git a/docs/helpers/GraphQLDataFactory.md b/docs/helpers/GraphQLDataFactory.md index d7795e773..56ece1d92 100644 --- a/docs/helpers/GraphQLDataFactory.md +++ b/docs/helpers/GraphQLDataFactory.md @@ -62,7 +62,7 @@ module.exports = new Factory((buildObj) => ({ input: { ...buildObj }, })) // 'attr'-id can be left out depending on the GraphQl resolvers - .attr('name', () => faker.name.findName()) + .attr('name', () => faker.person.findName()) .attr('email', () => faker.interact.email()) ``` diff --git a/lib/helper/ApiDataFactory.js b/lib/helper/ApiDataFactory.js index ece565636..7026a6c62 100644 --- a/lib/helper/ApiDataFactory.js +++ b/lib/helper/ApiDataFactory.js @@ -51,7 +51,7 @@ const REST = require('./REST') * * module.exports = new Factory() * // no need to set id, it will be set by REST API - * .attr('author', () => faker.name.findName()) + * .attr('author', () => faker.person.findName()) * .attr('title', () => faker.lorem.sentence()) * .attr('body', () => faker.lorem.paragraph()); * ``` diff --git a/lib/helper/GraphQLDataFactory.js b/lib/helper/GraphQLDataFactory.js index e45f7fe19..d6453b7b3 100644 --- a/lib/helper/GraphQLDataFactory.js +++ b/lib/helper/GraphQLDataFactory.js @@ -55,7 +55,7 @@ const GraphQL = require('./GraphQL') * input: { ...buildObj }, * })) * // 'attr'-id can be left out depending on the GraphQl resolvers - * .attr('name', () => faker.name.findName()) + * .attr('name', () => faker.person.findName()) * .attr('email', () => faker.interact.email()) * ``` * For more options see [rosie documentation](https://github.com/rosiejs/rosie). diff --git a/test/data/graphql/users_factory.js b/test/data/graphql/users_factory.js index 95292e9f6..9b57de272 100644 --- a/test/data/graphql/users_factory.js +++ b/test/data/graphql/users_factory.js @@ -4,5 +4,5 @@ const { faker } = require('@faker-js/faker'); module.exports = new Factory(function (buildObject) { this.input = { ...buildObject }; }) - .attr('name', () => faker.name.fullName()) + .attr('name', () => faker.person.fullName()) .attr('email', () => faker.internet.email()); diff --git a/test/data/rest/posts_factory.js b/test/data/rest/posts_factory.js index f0e676e44..a731dafb8 100644 --- a/test/data/rest/posts_factory.js +++ b/test/data/rest/posts_factory.js @@ -2,6 +2,6 @@ const { Factory } = require('rosie'); const { faker } = require('@faker-js/faker'); module.exports = new Factory() - .attr('author', () => faker.name.fullName()) + .attr('author', () => faker.person.fullName()) .attr('title', () => faker.lorem.sentence()) .attr('body', () => faker.lorem.paragraph());