Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(animal): add more simple animals to animal.type() #2786

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 40 additions & 9 deletions src/locales/en/animal/type.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
export default [
'dog',
'cat',
'snake',
'bat',
'bear',
'lion',
'cetacean',
'insect',
'crocodilia',
'cow',
'bee',
'bird',
'butterfly',
'cat',
'cow',
'crocodile',
'deer',
'dog',
'dolphin',
'eagle',
'elephant',
'fish',
'rabbit',
'flamingo',
'fox',
'frog',
'gecko',
'giraffe',
'gorilla',
'hamster',
'hippopotamus',
'horse',
'kangaroo',
'koala',
'lion',
'monkey',
'ostrich',
'panda',
'parrot',
'peacock',
'penguin',
'polar bear',
'rabbit',
'rhinoceros',
'sea lion',
'shark',
'snake',
'squirrel',
'tiger',
'turtle',
'whale',
'wolf',
'zebra',
];
2 changes: 1 addition & 1 deletion src/modules/animal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export class AnimalModule extends ModuleBase {
* Returns a random animal type.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a warning here, that this is not compatible with faker.animal[faker.animal.type()]()?
Because we have similar use-cases with person.sexType and color.cssSupportedFunction

*
* @example
* faker.animal.type() // 'crocodilia'
* faker.animal.type() // 'crocodile'
*
* @since 5.5.0
*/
Expand Down
6 changes: 3 additions & 3 deletions test/modules/__snapshots__/animal.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`animal > 42 > rodent 1`] = `"Famatina chinchilla rat"`;

exports[`animal > 42 > snake 1`] = `"Grey-banded kingsnake"`;

exports[`animal > 42 > type 1`] = `"lion"`;
exports[`animal > 42 > type 1`] = `"frog"`;

exports[`animal > 1211 > bear 1`] = `"Polar bear"`;

Expand Down Expand Up @@ -58,7 +58,7 @@ exports[`animal > 1211 > rodent 1`] = `"Strong tuco-tuco"`;

exports[`animal > 1211 > snake 1`] = `"Tiger pit viper"`;

exports[`animal > 1211 > type 1`] = `"horse"`;
exports[`animal > 1211 > type 1`] = `"turtle"`;

exports[`animal > 1337 > bear 1`] = `"Sun bear"`;

Expand Down Expand Up @@ -88,4 +88,4 @@ exports[`animal > 1337 > rodent 1`] = `"Crested porcupine"`;

exports[`animal > 1337 > snake 1`] = `"Eastern coral snake"`;

exports[`animal > 1337 > type 1`] = `"bear"`;
exports[`animal > 1337 > type 1`] = `"eagle"`;